-
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.
Merge pull request #42 from bulch/develop
Develop
- Loading branch information
Showing
16 changed files
with
259 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"ansible.python.interpreterPath": "venv/bin/python" | ||
} |
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ ansible-galaxy role install bulch.rsync_server | |
|
||
## Role Variables | ||
|
||
Default tvaribles | ||
Default varibles | ||
|
||
``` | ||
rsync_config_file: "/etc/rsyncd.conf" | ||
|
@@ -72,4 +72,3 @@ MIT / BSD | |
## Author Information | ||
|
||
This role was created in 2022 by [bulch](https://bulch.ru), <[email protected]> | ||
|
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,10 +1,9 @@ | ||
--- | ||
# defaults file for rsync_server | ||
|
||
rsync_config_file: "/etc/rsyncd.conf" | ||
rsync_config_port: 873 | ||
rsync_server_timeout: 300 | ||
rsync_server_max_connections: 2 | ||
rsync_packages: | ||
- rsync | ||
rsync_config_manage: [] | ||
rsync_config_manage: [] |
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ galaxy_info: | |
platforms: | ||
- name: Ubuntu | ||
versions: | ||
- bionic | ||
- noble | ||
- focal | ||
- jammy | ||
|
||
|
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,80 @@ | ||
--- | ||
- name: Create | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
molecule_inventory: | ||
all: | ||
hosts: {} | ||
molecule: {} | ||
tasks: | ||
- name: Create a container | ||
community.docker.docker_container: | ||
name: "{{ item.name }}" | ||
image: "{{ item.image }}" | ||
state: started | ||
command: sleep 1d | ||
log_driver: json-file | ||
register: result | ||
loop: "{{ molecule_yml.platforms }}" | ||
|
||
- name: Print some info | ||
ansible.builtin.debug: | ||
msg: "{{ result.results }}" | ||
|
||
- 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: | ||
children: | ||
molecule: | ||
hosts: | ||
"{{ item.name }}": | ||
ansible_connection: community.docker.docker | ||
ansible.builtin.set_fact: | ||
molecule_inventory: > | ||
{{ molecule_inventory | combine(inventory_partial_yaml | from_yaml, recursive=true) }} | ||
loop: "{{ molecule_yml.platforms }}" | ||
loop_control: | ||
label: "{{ item.name }}" | ||
|
||
- 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 | ||
|
||
- name: Fail if molecule group is missing | ||
ansible.builtin.assert: | ||
that: "'molecule' in groups" | ||
fail_msg: | | ||
molecule group was not found inside inventory groups: {{ groups }} | ||
run_once: true # noqa: run-once[task] | ||
|
||
# we want to avoid errors like "Failed to create temporary directory" | ||
- name: Validate that inventory was refreshed | ||
hosts: molecule | ||
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 }}" |
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,3 +1,5 @@ | ||
--- | ||
# Install a role from Ansible Galaxy. | ||
roles: [] | ||
collections: | ||
- name: community.docker | ||
version: ">=3.10.4" |
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 @@ | ||
--- | ||
path_default_config_rsync: "/etc/default/rsync" | ||
path_secret_rsync: "/etc/rsyncd.secrets" | ||
path_rsync_config: "/etc/rsyncd.conf" |
14 changes: 14 additions & 0 deletions
14
molecule/default/roles/test-rsync_server/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 was deleted.
Oops, something went wrong.
Oops, something went wrong.