June
5bb283d5e7
All checks were successful
/ Ansible Lint (push) Successful in 1m38s
Because of how Ansible local relative search paths work, the global "files" and "templates" directories need to be next to the playbooks. However its not intuitive to look into the "playbooks" directory to find the files and templates for a host. Therefore move them out of the "playbooks" directory into the root directory and add symlinks so everything still works. Similarly for local roles, they also need to be next to the playbooks. So for a nicer structure, move the "roles" directory out into the root directory as well and add a symlink so everything still works. Also see: https://docs.ansible.com/ansible/latest/playbook_guide/playbook_pathing.html#resolving-local-relative-paths https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#storing-and-finding-roles
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
- name: gather package facts
|
|
ansible.builtin.package_facts:
|
|
manager: apt
|
|
|
|
- name: make sure `gnupg` package is installed
|
|
ansible.builtin.apt:
|
|
name: gnupg
|
|
state: present
|
|
update_cache: true
|
|
become: true
|
|
when: "'gnupg' not in ansible_facts.packages"
|
|
|
|
- name: make sure NGINX signing key is added
|
|
ansible.builtin.get_url:
|
|
url: https://nginx.org/keys/nginx_signing.key
|
|
dest: /etc/apt/trusted.gpg.d/nginx.asc
|
|
mode: "0644"
|
|
owner: root
|
|
group: root
|
|
become: true
|
|
notify: apt-get update
|
|
|
|
- name: make sure NGINX APT repository is added
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/nginx.asc] https://nginx.org/packages/debian/ {{ ansible_distribution_release }} nginx"
|
|
state: present
|
|
become: true
|
|
notify: apt-get update
|
|
|
|
- name: make sure NGINX APT source repository is added
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb-src [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/nginx.asc] https://nginx.org/packages/debian/ {{ ansible_distribution_release }} nginx"
|
|
state: present
|
|
become: true
|
|
notify: apt-get update
|
|
|
|
- name: set up repository pinning to make sure nginx package gets installed from NGINX repositories
|
|
ansible.builtin.copy:
|
|
content: |
|
|
Package: *
|
|
Pin: origin nginx.org
|
|
Pin: release o=nginx
|
|
Pin-Priority: 900
|
|
dest: /etc/apt/preferences.d/99nginx
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
become: true
|
|
|
|
- name: Flush handlers to make sure "apt-get update" handler runs, if needed
|
|
ansible.builtin.meta: flush_handlers
|