-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for installing Ansible collections on IAG servers (#110)
* Update IAG Ansible version Add support for installing Ansible collections on IAG servers * Fix bug when IAG Ansible collection list is empty * Add size check when installing IAG packages * Rename install-ansible-collections to install-ansible-collections-offline
- Loading branch information
1 parent
203d68e
commit 9ce4d51
Showing
22 changed files
with
211 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Create Ansible collections download directory | ||
ansible.builtin.file: | ||
path: "{{ ansible_collections_download_dir_target_node }}" | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Download Ansible collections | ||
ansible.builtin.command: | ||
chdir: "{{ ansible_collections_download_dir_target_node }}" | ||
cmd: "{{ iag_pkgs_temp_dir.path }}/offline_install/bin/ansible-galaxy collection download {{ item }}" | ||
with_items: "{{ iag_ansible_collections }}" | ||
changed_when: true | ||
|
||
- name: Copy Ansible collections to control node | ||
ansible.builtin.import_role: | ||
name: offline | ||
tasks_from: fetch-packages | ||
vars: | ||
src_dir: "{{ ansible_collections_download_dir_target_node }}/collections" | ||
dest_dir: "{{ ansible_collections_download_dir_control_node }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
roles/gateway/tasks/install-ansible-collections-offline.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (c) 2024, Itential, Inc | ||
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- name: Create temporary working directory | ||
ansible.builtin.tempfile: | ||
state: directory | ||
register: install_collections_temp_dir | ||
|
||
- name: Copy collections to target node | ||
ansible.builtin.copy: | ||
src: "{{ item }}" | ||
dest: "{{ install_collections_temp_dir.path }}/{{ item | basename }}" | ||
mode: '0644' | ||
with_fileglob: | ||
- "{{ ansible_collections_download_dir_control_node }}/*.tar.gz" | ||
- "{{ ansible_collections_download_dir_control_node }}/requirements.yml" | ||
|
||
- name: Install collections | ||
ansible.builtin.command: | ||
cmd: "ansible-galaxy collection install -p {{ iag_ansible_collections_path }} -r requirements.yml" | ||
chdir: "{{ install_collections_temp_dir.path }}" | ||
register: install_result | ||
changed_when: '"Nothing to do" not in install_result.stdout' | ||
failed_when: install_result.failed | ||
when: | ||
- iag_ansible_collections is defined | ||
- iag_ansible_collections is iterable | ||
- iag_ansible_collections | length > 0 | ||
|
||
- name: Remove temporary working directory | ||
ansible.builtin.file: | ||
path: "{{ install_collections_temp_dir.path }}" | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[defaults] | ||
collections_path={{ iag_install_dir }}/ansible/collections:/usr/share/ansible/collections | ||
collections_path={{ iag_ansible_collections_path }}:/usr/share/ansible/collections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.