cookiecutter-ansible-role-d.../{{cookiecutter.app_name}}_role/tasks/install.yml

94 lines
4.7 KiB
YAML
Raw Normal View History

2020-04-28 13:23:10 +02:00
---
{% if cookiecutter.has_service == 'True' %}
- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} group
group:
name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
system: yes
state: present
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Ensure {{ cookiecutter.app_name }} user
user:
name: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}"
group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
system: yes
2021-06-14 17:21:16 +02:00
shell: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user_shell {% raw %}}}{% endraw %}"
2020-04-28 13:23:10 +02:00
createhome: no
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
{% endif %}
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton paths
file:
dest: "{% raw %}{{{% endraw %} item {% raw %}}}{% endraw %}"
{% if cookiecutter.has_service == 'True' %}
owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}"
group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
{% endif %}
state: directory
with_items:
- "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_skeleton_paths {% raw %}}}{% endraw %}"
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Ensure skeleton log paths
file:
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_log_path {% raw %}}}{% endraw %}"
{% if cookiecutter.has_service == 'True' %}
owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}"
group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
{% endif %}
state: directory
2020-04-28 13:23:10 +02:00
when: {{ cookiecutter.app_name }}_log_file is defined
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Check {{ cookiecutter.app_name }} version
command: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %} --version"
2020-04-28 13:23:10 +02:00
register: {{ cookiecutter.app_name }}_check
changed_when: false
ignore_errors: true
2021-03-29 14:57:06 +02:00
check_mode: no
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Download package
get_url:
url: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_url {% raw %}}}{% endraw %}"
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package_path {% raw %}}}{% endraw %}"
when: {{ cookiecutter.app_name }}_force_reinstall or {{ cookiecutter.app_name }}_check is failed or {{ cookiecutter.app_name }}_version not in {{ cookiecutter.app_name }}_check.stderr
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Extract downloaded package
unarchive:
src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_package_path {% raw %}}}{% endraw %}"
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_download_path {% raw %}}}{% endraw %}"
remote_src: True
when: {{ cookiecutter.app_name }}_force_reinstall or {{ cookiecutter.app_name }}_check is failed or {{ cookiecutter.app_name }}_version not in {{ cookiecutter.app_name }}_check.stderr
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Copy binary
copy:
src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_src_bin {% raw %}}}{% endraw %}"
dest: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}"
{% if cookiecutter.has_service == 'True' %}
owner: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_user {% raw %}}}{% endraw %}"
group: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_group {% raw %}}}{% endraw %}"
{% endif %}
remote_src: True
mode: 0755
when: {{ cookiecutter.app_name }}_force_reinstall or {{ cookiecutter.app_name }}_check is failed or {{ cookiecutter.app_name }}_version not in {{ cookiecutter.app_name }}_check.stderr
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install
2020-04-28 13:23:10 +02:00
- name: {{ cookiecutter.app_name | upper }} | Link binary
file:
src: "{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_bin_path {% raw %}}}{% endraw %}/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}"
dest: "/usr/bin/{% raw %}{{{% endraw %} {{ cookiecutter.app_name }}_exec_name {% raw %}}}{% endraw %}"
state: link
when: {{ cookiecutter.app_name }}_force_reinstall or {{ cookiecutter.app_name }}_check is failed or {{ cookiecutter.app_name }}_version not in {{ cookiecutter.app_name }}_check.stderr
2021-01-19 10:03:27 +01:00
tags:
- {{ cookiecutter.app_name }}_install