mirror of
https://github.com/rocky-linux/infrastructure
synced 2024-11-11 00:11:25 +00:00
ec056805ff
moved inv vars to group vars moved roles to collections and fixed playbooks added a prepare ansible host playbook to download needed roles and playbooks modified public roles and collection paths to install inside our dir structure to keep them from global installation
50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
---
|
|
|
|
- hosts: localhost
|
|
connection: local
|
|
vars:
|
|
force_purge: true
|
|
roles_installation_dir: roles/public
|
|
collection_installation_dir: collections
|
|
installation_prefix: ../
|
|
pre_tasks:
|
|
# example prepare ansible box for execution
|
|
# - name: install required pip modules on the host running ansible
|
|
# pip:
|
|
# name:
|
|
# - jmespath
|
|
# - netaddr
|
|
# - python-consul
|
|
# - pyvmomi
|
|
# - python-ldap
|
|
# - twine
|
|
|
|
- name: Remove existing public roles
|
|
file:
|
|
path: "{{ installation_prefix }}{{ roles_installation_dir }}"
|
|
state: absent
|
|
when: force_purge | bool
|
|
|
|
- name: Install all public roles
|
|
command: >
|
|
ansible-galaxy role install
|
|
{{ ( force_purge | bool ) | ternary('--force','') }}
|
|
--role-file {{ installation_prefix }}roles/requirements.yml
|
|
--roles-path {{ installation_prefix }}{{ roles_installation_dir }}
|
|
|
|
- name: Install needed collections
|
|
command: >
|
|
ansible-galaxy collection install
|
|
{{ ( force_purge | bool ) | ternary('--force-with-deps','') }}
|
|
-r {{ installation_prefix }}roles/requirements.yml
|
|
-p {{ installation_prefix }}{{ collection_installation_dir }}
|
|
|
|
- name: cleanup old ssh known_hosts
|
|
file:
|
|
path: "../tmp/known_hosts"
|
|
state: absent
|
|
- file:
|
|
path: "../tmp/known_hosts"
|
|
state: touch
|
|
|