From 961096d1aa21afe45874dabc54636f40b751a5bf Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Fri, 4 Apr 2025 12:54:29 +0200 Subject: [PATCH] First init --- ansible/main-lab/ensure-micro.yaml | 2 - ansible/main-lab/ensure-network-acess.yaml | 5 --- ansible/main-lab/inventory.yaml | 17 --------- .../main-lab/inventory/static_inventory.yaml | 4 +- ansible/main-lab/nodes.yml | 5 +++ .../main-lab/roles/common/defaults/main.yml | 2 + .../roles/common/tasks/basic-check-node.yml | 7 ++++ ansible/main-lab/roles/common/tasks/main.yml | 11 ++++++ ansible/main-lab/roles/docker/README.md | 38 +++++++++++++++++++ .../main-lab/roles/docker/defaults/main.yml | 3 ++ .../main-lab/roles/docker/handlers/main.yml | 3 ++ ansible/main-lab/roles/docker/meta/main.yml | 35 +++++++++++++++++ ansible/main-lab/roles/docker/tasks/main.yml | 3 ++ ansible/main-lab/roles/docker/tests/inventory | 3 ++ ansible/main-lab/roles/docker/tests/test.yml | 6 +++ ansible/main-lab/roles/docker/vars/main.yml | 3 ++ ansible/rup/site.yaml | 3 -- 17 files changed, 122 insertions(+), 28 deletions(-) delete mode 100644 ansible/main-lab/ensure-micro.yaml delete mode 100644 ansible/main-lab/ensure-network-acess.yaml delete mode 100644 ansible/main-lab/inventory.yaml create mode 100644 ansible/main-lab/nodes.yml create mode 100644 ansible/main-lab/roles/common/defaults/main.yml create mode 100644 ansible/main-lab/roles/common/tasks/basic-check-node.yml create mode 100644 ansible/main-lab/roles/common/tasks/main.yml create mode 100644 ansible/main-lab/roles/docker/README.md create mode 100644 ansible/main-lab/roles/docker/defaults/main.yml create mode 100644 ansible/main-lab/roles/docker/handlers/main.yml create mode 100644 ansible/main-lab/roles/docker/meta/main.yml create mode 100644 ansible/main-lab/roles/docker/tasks/main.yml create mode 100644 ansible/main-lab/roles/docker/tests/inventory create mode 100644 ansible/main-lab/roles/docker/tests/test.yml create mode 100644 ansible/main-lab/roles/docker/vars/main.yml delete mode 100644 ansible/rup/site.yaml diff --git a/ansible/main-lab/ensure-micro.yaml b/ansible/main-lab/ensure-micro.yaml deleted file mode 100644 index 1744035..0000000 --- a/ansible/main-lab/ensure-micro.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- hosts: operators \ No newline at end of file diff --git a/ansible/main-lab/ensure-network-acess.yaml b/ansible/main-lab/ensure-network-acess.yaml deleted file mode 100644 index 93bbac2..0000000 --- a/ansible/main-lab/ensure-network-acess.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: all - tasks: - - name: Example from an Ansible Playbook - ansible.builtin.ping: \ No newline at end of file diff --git a/ansible/main-lab/inventory.yaml b/ansible/main-lab/inventory.yaml deleted file mode 100644 index 4f482f3..0000000 --- a/ansible/main-lab/inventory.yaml +++ /dev/null @@ -1,17 +0,0 @@ -all: - children: - lan: - inspector.home.arpa - god.home.arpa - enabling: - enabling[1:3].home.arpa - swarm: - swarm1m[1:3].home.arpa - swarm1w[1:4].home.arpa - cluster: - worker[1:3].home.arpa - front: - edge.home.arpa - - - diff --git a/ansible/main-lab/inventory/static_inventory.yaml b/ansible/main-lab/inventory/static_inventory.yaml index 9cc5263..0910f4f 100644 --- a/ansible/main-lab/inventory/static_inventory.yaml +++ b/ansible/main-lab/inventory/static_inventory.yaml @@ -1,8 +1,10 @@ all: + vars: + ansible_network_os: community.network.ce children: lan: hosts: - inspector.home.arpa: +# inspector.home.arpa: god.home.arpa: enabling: hosts: diff --git a/ansible/main-lab/nodes.yml b/ansible/main-lab/nodes.yml new file mode 100644 index 0000000..7157975 --- /dev/null +++ b/ansible/main-lab/nodes.yml @@ -0,0 +1,5 @@ +--- +- name: Basic check nodes + hosts: all + roles: + - role: common \ No newline at end of file diff --git a/ansible/main-lab/roles/common/defaults/main.yml b/ansible/main-lab/roles/common/defaults/main.yml new file mode 100644 index 0000000..7480a9e --- /dev/null +++ b/ansible/main-lab/roles/common/defaults/main.yml @@ -0,0 +1,2 @@ +--- +config-flavor: none \ No newline at end of file diff --git a/ansible/main-lab/roles/common/tasks/basic-check-node.yml b/ansible/main-lab/roles/common/tasks/basic-check-node.yml new file mode 100644 index 0000000..a4ab550 --- /dev/null +++ b/ansible/main-lab/roles/common/tasks/basic-check-node.yml @@ -0,0 +1,7 @@ +--- +- name: Check node up + ansible.builtin.ping: + +- name: Check public network access + ansible.netcommon.net_ping: + dest: 8.8.8.8 diff --git a/ansible/main-lab/roles/common/tasks/main.yml b/ansible/main-lab/roles/common/tasks/main.yml new file mode 100644 index 0000000..048646c --- /dev/null +++ b/ansible/main-lab/roles/common/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: Ping node + ansible.builtin.ping: + +- name: Check internal DNS + ansible.netcommon.net_ping: + dest: edge.home.arpa + +- name: Check access to WAN + ansible.netcommon.net_ping: + dest: 1.1.1.1 \ No newline at end of file diff --git a/ansible/main-lab/roles/docker/README.md b/ansible/main-lab/roles/docker/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/ansible/main-lab/roles/docker/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/ansible/main-lab/roles/docker/defaults/main.yml b/ansible/main-lab/roles/docker/defaults/main.yml new file mode 100644 index 0000000..6b91042 --- /dev/null +++ b/ansible/main-lab/roles/docker/defaults/main.yml @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: MIT-0 +--- +# defaults file for docker diff --git a/ansible/main-lab/roles/docker/handlers/main.yml b/ansible/main-lab/roles/docker/handlers/main.yml new file mode 100644 index 0000000..cfc4e72 --- /dev/null +++ b/ansible/main-lab/roles/docker/handlers/main.yml @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: MIT-0 +--- +# handlers file for docker diff --git a/ansible/main-lab/roles/docker/meta/main.yml b/ansible/main-lab/roles/docker/meta/main.yml new file mode 100644 index 0000000..36b9858 --- /dev/null +++ b/ansible/main-lab/roles/docker/meta/main.yml @@ -0,0 +1,35 @@ +#SPDX-License-Identifier: MIT-0 +galaxy_info: + author: your name + description: your role description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: 2.1 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/ansible/main-lab/roles/docker/tasks/main.yml b/ansible/main-lab/roles/docker/tasks/main.yml new file mode 100644 index 0000000..797ef6a --- /dev/null +++ b/ansible/main-lab/roles/docker/tasks/main.yml @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: MIT-0 +--- +# tasks file for docker diff --git a/ansible/main-lab/roles/docker/tests/inventory b/ansible/main-lab/roles/docker/tests/inventory new file mode 100644 index 0000000..03ca42f --- /dev/null +++ b/ansible/main-lab/roles/docker/tests/inventory @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: MIT-0 +localhost + diff --git a/ansible/main-lab/roles/docker/tests/test.yml b/ansible/main-lab/roles/docker/tests/test.yml new file mode 100644 index 0000000..e4f8498 --- /dev/null +++ b/ansible/main-lab/roles/docker/tests/test.yml @@ -0,0 +1,6 @@ +#SPDX-License-Identifier: MIT-0 +--- +- hosts: localhost + remote_user: root + roles: + - docker diff --git a/ansible/main-lab/roles/docker/vars/main.yml b/ansible/main-lab/roles/docker/vars/main.yml new file mode 100644 index 0000000..286fe09 --- /dev/null +++ b/ansible/main-lab/roles/docker/vars/main.yml @@ -0,0 +1,3 @@ +#SPDX-License-Identifier: MIT-0 +--- +# vars file for docker diff --git a/ansible/rup/site.yaml b/ansible/rup/site.yaml deleted file mode 100644 index bf539ca..0000000 --- a/ansible/rup/site.yaml +++ /dev/null @@ -1,3 +0,0 @@ -all: - children: - rupfront.home.arpa