-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
205 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
tasks: | ||
- name: "Include ednxzu.manage_pip_packages" | ||
ansible.builtin.include_role: | ||
name: "ednxzu.manage_pip_packages" |
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,35 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
requirements-file: ./requirements.yml | ||
driver: | ||
name: vagrant | ||
provider: | ||
name: libvirt | ||
platforms: | ||
- name: instance | ||
box: generic/${MOLECULE_TEST_OS} | ||
cpus: 4 | ||
memory: 4096 | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
remote_tmp: /tmp/.ansible | ||
verifier: | ||
name: ansible | ||
scenario: | ||
name: default_vagrant | ||
test_sequence: | ||
- dependency | ||
- cleanup | ||
- destroy | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
- idempotence | ||
- verify | ||
- cleanup | ||
- destroy |
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,4 @@ | ||
--- | ||
# requirements file for molecule | ||
roles: | ||
- name: ednxzu.manage_apt_packages |
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,50 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: "Test: file /etc/hosts" | ||
block: | ||
- name: "Stat file /etc/hosts" | ||
ansible.builtin.stat: | ||
path: "/etc/hosts" | ||
register: stat_etc_hosts | ||
|
||
- name: "Verify file /etc/hosts" | ||
vars: | ||
etc_hosts_group: | ||
ubuntu: "adm" | ||
debian: "root" | ||
ansible.builtin.assert: | ||
that: | ||
- stat_etc_hosts.stat.exists | ||
- stat_etc_hosts.stat.isreg | ||
- stat_etc_hosts.stat.pw_name == 'root' | ||
- stat_etc_hosts.stat.gr_name == etc_hosts_group[(ansible_distribution|lower)] | ||
|
||
- name: "Test: packages pip, vault-cli, yamllint, docker" | ||
block: | ||
- name: "Get pip3 up-to-date packages" | ||
ansible.builtin.command: "pip3 list -u --format=json" | ||
changed_when: false | ||
register: pip_updated_packages | ||
|
||
- name: "Get pip3 out-of-date packages" | ||
ansible.builtin.command: "pip3 list -o --format=json" | ||
changed_when: false | ||
register: pip_outdated_packages | ||
|
||
- name: "Verify packages pip, vault-cli, yamllint, docker" | ||
vars: | ||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}" | ||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}" | ||
ansible.builtin.assert: | ||
that: | ||
- "'pip' in pip_up_to_date_list" | ||
- "'pip' not in pip_out_of_date_list" | ||
- "'vault-cli' not in pip_up_to_date_list" | ||
- "'vault-cli' not in pip_out_of_date_list" | ||
- "'yamllint' not in pip_up_to_date_list" | ||
- "'yamllint' not in pip_out_of_date_list" | ||
- "'docker' not in pip_up_to_date_list" | ||
- "'docker' not in pip_out_of_date_list" |
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,7 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
tasks: | ||
- name: "Include ednxzu.manage_pip_packages" | ||
ansible.builtin.include_role: | ||
name: "ednxzu.manage_pip_packages" |
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,13 @@ | ||
--- | ||
manage_pip_packages_install_prereqs: true | ||
manage_pip_packages_list: | ||
- name: docker | ||
version_constraint: latest | ||
state: present | ||
- name: yamllint | ||
version_constraint: '==1.24' | ||
state: present | ||
- name: vault-cli | ||
version_constraint: '<3.1.0' | ||
state: present | ||
manage_pip_packages_allow_break_system_packages: false |
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,35 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
requirements-file: ./requirements.yml | ||
driver: | ||
name: vagrant | ||
provider: | ||
name: libvirt | ||
platforms: | ||
- name: instance | ||
box: generic/${MOLECULE_TEST_OS} | ||
cpus: 4 | ||
memory: 4096 | ||
provisioner: | ||
name: ansible | ||
config_options: | ||
defaults: | ||
remote_tmp: /tmp/.ansible | ||
verifier: | ||
name: ansible | ||
scenario: | ||
name: with_custom_packages_vagrant | ||
test_sequence: | ||
- dependency | ||
- cleanup | ||
- destroy | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
- idempotence | ||
- verify | ||
- cleanup | ||
- destroy |
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,4 @@ | ||
--- | ||
# requirements file for molecule | ||
roles: | ||
- name: ednxzu.manage_apt_packages |
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,50 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: true | ||
tasks: | ||
- name: "Test: file /etc/hosts" | ||
block: | ||
- name: "Stat file /etc/hosts" | ||
ansible.builtin.stat: | ||
path: "/etc/hosts" | ||
register: stat_etc_hosts | ||
|
||
- name: "Verify file /etc/hosts" | ||
vars: | ||
etc_hosts_group: | ||
ubuntu: "adm" | ||
debian: "root" | ||
ansible.builtin.assert: | ||
that: | ||
- stat_etc_hosts.stat.exists | ||
- stat_etc_hosts.stat.isreg | ||
- stat_etc_hosts.stat.pw_name == 'root' | ||
- stat_etc_hosts.stat.gr_name == etc_hosts_group[(ansible_distribution|lower)] | ||
|
||
- name: "Test: packages pip, vault-cli, yamllint, docker" | ||
block: | ||
- name: "Get pip3 up-to-date packages" | ||
ansible.builtin.command: "pip3 list -u --format=json" | ||
changed_when: false | ||
register: pip_updated_packages | ||
|
||
- name: "Get pip3 out-of-date packages" | ||
ansible.builtin.command: "pip3 list -o --format=json" | ||
changed_when: false | ||
register: pip_outdated_packages | ||
|
||
- name: "Verify packages pip, vault-cli, yamllint, docker" | ||
vars: | ||
pip_up_to_date_list: "{{ pip_updated_packages.stdout | from_json | json_query('[].name') }}" | ||
pip_out_of_date_list: "{{ pip_outdated_packages.stdout | from_json | json_query('[].name') }}" | ||
ansible.builtin.assert: | ||
that: | ||
- "'pip' in pip_up_to_date_list" | ||
- "'pip' not in pip_out_of_date_list" | ||
- "'vault-cli' not in pip_up_to_date_list" | ||
- "'vault-cli' in pip_out_of_date_list" | ||
- "'yamllint' not in pip_up_to_date_list" | ||
- "'yamllint' in pip_out_of_date_list" | ||
- "'docker' in pip_up_to_date_list" | ||
- "'docker' not in pip_out_of_date_list" |