-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#53: Up to date and maintenance of all Ansible Collections - Non-HA a…
…nd HA (#54)
- Loading branch information
1 parent
aee41cc
commit 76f7e8b
Showing
86 changed files
with
2,761 additions
and
368 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
10 changes: 10 additions & 0 deletions
10
...ons/ansible_collections/authentication/kerberos/extensions/molecule/ha_setup/converge.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,10 @@ | ||
--- | ||
- name: Setup Kerberos server | ||
hosts: kerberos | ||
gather_facts: true | ||
roles: | ||
- role: ide.environment.user_and_groups | ||
- role: tls.certs.issue | ||
- role: tls.certs.distribute | ||
- role: authorization.ldap.setup | ||
- role: authentication.kerberos.setup |
103 changes: 103 additions & 0 deletions
103
...tions/ansible_collections/authentication/kerberos/extensions/molecule/ha_setup/create.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,103 @@ | ||
--- | ||
- name: Create | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
molecule_inventory: | ||
all: | ||
hosts: {} | ||
tasks: | ||
- name: Create docker network | ||
community.docker.docker_network: | ||
name: example.com | ||
ipam_config: | ||
- subnet: 172.23.27.0/24 | ||
gateway: 172.23.27.2 | ||
iprange: 172.23.27.0/26 | ||
|
||
- name: Create container | ||
become: true | ||
community.docker.docker_container: | ||
name: "{{ item.name }}" | ||
image: "{{ item.image }}" | ||
state: started | ||
command: "{{ item.command }}" | ||
log_driver: json-file | ||
publish_all_ports: true | ||
cgroupns_mode: "{{ item.cgroupns_mode }}" | ||
privileged: "{{ item.privileged }}" | ||
volumes: "{{ item.volumes }}" | ||
networks: | ||
- name: example.com | ||
ipv4_address: "{{ item.ipv4_address }}" | ||
hostname: "{{ item.name }}.example.com" | ||
tls_hostname: "{{ item.name }}.example.com" | ||
capabilities: | ||
- NET_ADMIN | ||
register: result | ||
loop: "{{ molecule_yml.platforms }}" | ||
|
||
- name: Fail if container is not running | ||
when: > | ||
item.container.State.ExitCode != 0 or | ||
not item.container.State.Running | ||
ansible.builtin.include_tasks: | ||
file: tasks/create-fail.yml | ||
loop: "{{ result.results }}" | ||
loop_control: | ||
label: "{{ item.container.Name }}" | ||
|
||
- name: Add container to molecule_inventory | ||
vars: | ||
inventory_partial_yaml: | | ||
all: | ||
vars: | ||
ansible_connection: community.docker.docker | ||
children: | ||
kerberos1: | ||
hosts: | ||
instance-1: | ||
kerberos2: | ||
hosts: | ||
instance-2: | ||
kerberos: | ||
children: | ||
kerberos1: | ||
kerberos2: | ||
ldap1: | ||
hosts: | ||
instance-1: | ||
ldap2: | ||
hosts: | ||
instance-2: | ||
ldap: | ||
children: | ||
ldap1: | ||
ldap2: | ||
ansible.builtin.set_fact: | ||
molecule_inventory: > | ||
{{ molecule_inventory | combine(inventory_partial_yaml | from_yaml, recursive=true) }} | ||
- name: Dump molecule_inventory | ||
ansible.builtin.copy: | ||
content: | | ||
{{ molecule_inventory | to_yaml }} | ||
dest: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml" | ||
mode: "0600" | ||
|
||
- name: Force inventory refresh | ||
ansible.builtin.meta: refresh_inventory | ||
|
||
# we want to avoid errors like "Failed to create temporary directory" | ||
- name: Validate that inventory was refreshed | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Check uname | ||
ansible.builtin.raw: uname -a | ||
register: result | ||
changed_when: false | ||
|
||
- name: Display uname info | ||
ansible.builtin.debug: | ||
msg: "{{ result.stdout }}" |
22 changes: 22 additions & 0 deletions
22
...ions/ansible_collections/authentication/kerberos/extensions/molecule/ha_setup/destroy.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,22 @@ | ||
--- | ||
- name: Destroy molecule containers | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Stop and remove container | ||
delegate_to: localhost | ||
become: true | ||
community.docker.docker_container: | ||
name: "{{ inventory_hostname }}" | ||
state: absent | ||
auto_remove: true | ||
|
||
- name: Remove dynamic molecule inventory | ||
hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Remove dynamic inventory file | ||
become: true | ||
ansible.builtin.file: | ||
path: "{{ molecule_ephemeral_directory }}/inventory/molecule_inventory.yml" | ||
state: absent |
95 changes: 95 additions & 0 deletions
95
...ons/ansible_collections/authentication/kerberos/extensions/molecule/ha_setup/molecule.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,95 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
requirements-file: requirements.yml | ||
platforms: | ||
- name: instance-1 | ||
image: docker.io/geerlingguy/docker-ubuntu2404-ansible | ||
command: /usr/lib/systemd/systemd | ||
pre_build_image: true | ||
cgroupns_mode: host | ||
ipv4_address: 172.23.27.3 | ||
privileged: true | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
- /var/lib/containerd | ||
- name: instance-2 | ||
image: docker.io/geerlingguy/docker-ubuntu2404-ansible | ||
command: /usr/lib/systemd/systemd | ||
pre_build_image: true | ||
cgroupns_mode: host | ||
ipv4_address: 172.23.27.4 | ||
privileged: true | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
- /var/lib/containerd | ||
provisioner: | ||
name: ansible | ||
log: false | ||
options: | ||
vvv: false | ||
playbooks: | ||
converge: converge.yml | ||
inventory: | ||
group_vars: | ||
all: | ||
molecule_deployment: true | ||
ldap_external: false | ||
ldap_user: openldap | ||
ldap_uid: "5001" | ||
ldap_group: openldap | ||
ldap_gid: "4001" | ||
service_user: "{{ ldap_user }}" | ||
service_name: Open LDAP | ||
service_uid: "{{ ldap_uid }}" | ||
service_group: "{{ ldap_group }}" | ||
service_gid: "{{ ldap_gid }}" | ||
tls_user: "{{ ldap_user }}" | ||
tls_group: "{{ ldap_group }}" | ||
self_signed_certificates: true | ||
certs_source: | ||
- /tmp/selfsigned_certs/{{ ansible_fqdn }}/cert.pem | ||
- /tmp/selfsigned_certs/{{ ansible_fqdn }}/chain.pem | ||
- /tmp/selfsigned_certs/{{ ansible_fqdn }}/key.pem | ||
certs_dest: | ||
- cert.pem | ||
- chain.pem | ||
- key.pem | ||
certs_mode: | ||
- "0660" | ||
- "0660" | ||
- "0400" | ||
domain: example.com | ||
keystore_file: /etc/ssl/private/{{ ansible_fqdn }}.jks | ||
keystore_password: changeit | ||
truststore_file: /etc/ssl/certs/truststore.jks | ||
truststore_password: changeit | ||
ldap_server_address: "{% for host in groups.ldap | shuffle %}ldaps://{{ host }}.example.com:636{% if not loop.last %},{% endif %}{% endfor %}" | ||
ldap_organization: dc=example,dc=com | ||
ldap_user_search_base: ou=people,{{ ldap_organization }} | ||
ldap_group_search_base: ou=groups,{{ ldap_organization }} | ||
ldap_bind_user: cn=admin,{{ ldap_organization }} | ||
ldap_password: changeit | ||
ldap_bind_dn_template: uid={username},{{ ldap_user_search_base }} | ||
ide_users_group: ide_users | ||
ide_users_gid: "5001" | ||
ldap_users: | ||
- name: teppler | ||
uid_number: 6000 | ||
gid_number: "{{ ide_users_gid }}" | ||
password: albstadt | ||
- name: anolle | ||
uid_number: 6001 | ||
gid_number: "{{ ide_users_gid }}" | ||
password: sigmaringen | ||
- name: gschulz | ||
uid_number: 6002 | ||
gid_number: "{{ ide_users_gid }}" | ||
password: datascience | ||
ldap_replication_user: cn=replicator,{{ ldap_organization }} | ||
ldap_replication_password: changeit | ||
ldap_kdc_service_password: changeit | ||
ldap_kadmin_service_password: changeit | ||
realm: COMMUNITY.LAB | ||
realm_password: changeit |
3 changes: 3 additions & 0 deletions
3
...ansible_collections/authentication/kerberos/extensions/molecule/ha_setup/requirements.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,3 @@ | ||
--- | ||
collections: | ||
- name: community.docker |
14 changes: 14 additions & 0 deletions
14
...le_collections/authentication/kerberos/extensions/molecule/ha_setup/tasks/create-fail.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,14 @@ | ||
--- | ||
- name: Retrieve container log | ||
ansible.builtin.command: | ||
cmd: >- | ||
{% raw %} | ||
docker logs | ||
{% endraw %} | ||
{{ item.stdout_lines[0] }} | ||
changed_when: false | ||
register: logfile_cmd | ||
|
||
- name: Display container log | ||
ansible.builtin.fail: | ||
msg: "{{ logfile_cmd.stderr }}" |
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.