add: initial files for domac
This commit is contained in:
commit
74fe532aa2
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.swp
|
||||
19
Taskfile.yml
Normal file
19
Taskfile.yml
Normal file
@ -0,0 +1,19 @@
|
||||
version: 3
|
||||
|
||||
tasks:
|
||||
|
||||
install_deps:
|
||||
desc: Install galaxy requirements
|
||||
cmds:
|
||||
- ansible-galaxy install -r requirements.yml
|
||||
|
||||
run:
|
||||
desc: Run site playbook
|
||||
cmds:
|
||||
- ansible-playbook playbooks/hello.yml
|
||||
|
||||
inventory:
|
||||
desc: show inventyory
|
||||
aliases: [inv]
|
||||
cmds:
|
||||
- ansible-inventory --graph
|
||||
11
ansible.cfg
Normal file
11
ansible.cfg
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
|
||||
[defaults]
|
||||
collections_path = ansible_collections/
|
||||
|
||||
inventory = inventories
|
||||
|
||||
# For development only
|
||||
# host_key_checking = False
|
||||
|
||||
1
ansible_collections/activia/infra_common
Symbolic link
1
ansible_collections/activia/infra_common
Symbolic link
@ -0,0 +1 @@
|
||||
../../../ansible-collection-infra-common/
|
||||
96
ansible_collections/activia/infra_common_RAW/FILES.json
Normal file
96
ansible_collections/activia/infra_common_RAW/FILES.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"files": [
|
||||
{
|
||||
"name": ".",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_web",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_web/tasks",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_web/tasks/main.yml",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "a7f5e5634a46103e9b70538ca016d12a53752b60c10055229f13049e6feb61a5",
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_db",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_db/tasks",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "roles/configure_db/tasks/main.yml",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "15a8f838a77ee3d7666611b17a1b854bfc29d7a0e90fd473a2c0532fb7134970",
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "meta",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "meta/runtime.yml",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "7b1d88aa041500f5b4a36c20a58adf116fbb48af9b5aa3be93949bd12cdae9dd",
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "README.md",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "e893bf2c512f6c1962e6af28c91c042396eb14f097b11306968629760193b70d",
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "plugins",
|
||||
"ftype": "dir",
|
||||
"chksum_type": null,
|
||||
"chksum_sha256": null,
|
||||
"format": 1
|
||||
},
|
||||
{
|
||||
"name": "plugins/README.md",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "198c518c26e91bc01c3d50d163582796f2fa21c7b66a5581394b031469942d72",
|
||||
"format": 1
|
||||
}
|
||||
],
|
||||
"format": 1
|
||||
}
|
||||
30
ansible_collections/activia/infra_common_RAW/MANIFEST.json
Normal file
30
ansible_collections/activia/infra_common_RAW/MANIFEST.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"collection_info": {
|
||||
"namespace": "activia",
|
||||
"name": "infra_common",
|
||||
"version": "1.0.0",
|
||||
"authors": [
|
||||
"your name <example@domain.com>"
|
||||
],
|
||||
"readme": "README.md",
|
||||
"tags": [],
|
||||
"description": "your collection description",
|
||||
"license": [
|
||||
"GPL-2.0-or-later"
|
||||
],
|
||||
"license_file": null,
|
||||
"dependencies": {},
|
||||
"repository": "http://example.com/repository",
|
||||
"documentation": "http://docs.example.com",
|
||||
"homepage": "http://example.com",
|
||||
"issues": "http://example.com/issue/tracker"
|
||||
},
|
||||
"file_manifest_file": {
|
||||
"name": "FILES.json",
|
||||
"ftype": "file",
|
||||
"chksum_type": "sha256",
|
||||
"chksum_sha256": "61968d0a6bfe6ef4a2c778eca2be434ca326a253910a4fbe49e7a6292de6ee01",
|
||||
"format": 1
|
||||
},
|
||||
"format": 1
|
||||
}
|
||||
3
ansible_collections/activia/infra_common_RAW/README.md
Normal file
3
ansible_collections/activia/infra_common_RAW/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Ansible Collection - activia.infra_common
|
||||
|
||||
Documentation for the collection.
|
||||
@ -0,0 +1,52 @@
|
||||
---
|
||||
# Collections must specify a minimum required ansible version to upload
|
||||
# to galaxy
|
||||
# requires_ansible: '>=2.9.10'
|
||||
|
||||
# Content that Ansible needs to load from another location or that has
|
||||
# been deprecated/removed
|
||||
# plugin_routing:
|
||||
# action:
|
||||
# redirected_plugin_name:
|
||||
# redirect: ns.col.new_location
|
||||
# deprecated_plugin_name:
|
||||
# deprecation:
|
||||
# removal_version: "4.0.0"
|
||||
# warning_text: |
|
||||
# See the porting guide on how to update your playbook to
|
||||
# use ns.col.another_plugin instead.
|
||||
# removed_plugin_name:
|
||||
# tombstone:
|
||||
# removal_version: "2.0.0"
|
||||
# warning_text: |
|
||||
# See the porting guide on how to update your playbook to
|
||||
# use ns.col.another_plugin instead.
|
||||
# become:
|
||||
# cache:
|
||||
# callback:
|
||||
# cliconf:
|
||||
# connection:
|
||||
# doc_fragments:
|
||||
# filter:
|
||||
# httpapi:
|
||||
# inventory:
|
||||
# lookup:
|
||||
# module_utils:
|
||||
# modules:
|
||||
# netconf:
|
||||
# shell:
|
||||
# strategy:
|
||||
# terminal:
|
||||
# test:
|
||||
# vars:
|
||||
|
||||
# Python import statements that Ansible needs to load from another location
|
||||
# import_redirection:
|
||||
# ansible_collections.ns.col.plugins.module_utils.old_location:
|
||||
# redirect: ansible_collections.ns.col.plugins.module_utils.new_location
|
||||
|
||||
# Groups of actions/modules that take a common set of options
|
||||
# action_groups:
|
||||
# group_name:
|
||||
# - module1
|
||||
# - module2
|
||||
@ -0,0 +1,31 @@
|
||||
# Collections Plugins Directory
|
||||
|
||||
This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
|
||||
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
|
||||
would contain module utils and modules respectively.
|
||||
|
||||
Here is an example directory of the majority of plugins currently supported by Ansible:
|
||||
|
||||
```
|
||||
└── plugins
|
||||
├── action
|
||||
├── become
|
||||
├── cache
|
||||
├── callback
|
||||
├── cliconf
|
||||
├── connection
|
||||
├── filter
|
||||
├── httpapi
|
||||
├── inventory
|
||||
├── lookup
|
||||
├── module_utils
|
||||
├── modules
|
||||
├── netconf
|
||||
├── shell
|
||||
├── strategy
|
||||
├── terminal
|
||||
├── test
|
||||
└── vars
|
||||
```
|
||||
|
||||
A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.16/plugins/plugins.html).
|
||||
@ -0,0 +1,4 @@
|
||||
|
||||
- name: This task configure the DB server
|
||||
debug:
|
||||
msg: The DB server has been configured
|
||||
@ -0,0 +1,4 @@
|
||||
|
||||
- name: This task configure the web server
|
||||
debug:
|
||||
msg: The WEB server has been configured
|
||||
11
inventories/00-common.yml
Normal file
11
inventories/00-common.yml
Normal file
@ -0,0 +1,11 @@
|
||||
all:
|
||||
children:
|
||||
env:
|
||||
# Place your environment here
|
||||
roles:
|
||||
# Place role mapping here
|
||||
children:
|
||||
role_web:
|
||||
vars:
|
||||
app_domain: "domain.{{ top_domain }}"
|
||||
role_db:
|
||||
25
inventories/fake/hosts.yml
Normal file
25
inventories/fake/hosts.yml
Normal file
@ -0,0 +1,25 @@
|
||||
env_fake:
|
||||
hosts:
|
||||
local:
|
||||
fake-domac-web1:
|
||||
fake-domac-web2:
|
||||
fake-domac-db:
|
||||
vars:
|
||||
ansible_host: localhost
|
||||
ansible_connection: local
|
||||
environment_name: fake
|
||||
|
||||
roles:
|
||||
children:
|
||||
role_web:
|
||||
hosts:
|
||||
fake-domac-web1:
|
||||
fake-domac-web2:
|
||||
#vars:
|
||||
# ansible_user: root
|
||||
role_db:
|
||||
hosts:
|
||||
fake-domac-db:
|
||||
#vars:
|
||||
# ansible_become: true
|
||||
# ansible_become_pass: password
|
||||
21
inventories/lab/hosts.yml
Normal file
21
inventories/lab/hosts.yml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
env_lab:
|
||||
hosts:
|
||||
rocky-1:
|
||||
ansible_host: 192.168.122.222
|
||||
rocky-2:
|
||||
ansible_host: 192.168.122.96
|
||||
vars:
|
||||
ansible_user: cloud-user
|
||||
environment_name: lab
|
||||
|
||||
# Inject roles
|
||||
roles:
|
||||
children:
|
||||
role_web:
|
||||
hosts:
|
||||
rocky-1:
|
||||
role_db:
|
||||
hosts:
|
||||
rocky-2:
|
||||
|
||||
30
inventories/rob/toto.yml
Normal file
30
inventories/rob/toto.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
env_rob:
|
||||
hosts:
|
||||
rocky-1:
|
||||
ansible_host: 192.168.122.87
|
||||
rocky-2:
|
||||
ansible_host: 1.2.3.4
|
||||
rocky-3:
|
||||
ansible_host: 192.168.122.229
|
||||
vars:
|
||||
ansible_user: cloud-user
|
||||
environment_name: rob
|
||||
|
||||
# Inject roles
|
||||
roles:
|
||||
children:
|
||||
role_web:
|
||||
vars:
|
||||
app_domain: titi.activia.cim
|
||||
hosts:
|
||||
rocky-1:
|
||||
role_db:
|
||||
hosts:
|
||||
rocky-1:
|
||||
role_admin:
|
||||
vars:
|
||||
app_domain: admin.activia.cim
|
||||
hosts:
|
||||
rocky-1:
|
||||
|
||||
13
inventories/zz-constructed.yml
Normal file
13
inventories/zz-constructed.yml
Normal file
@ -0,0 +1,13 @@
|
||||
# inventory.config file in YAML format
|
||||
# Documentation: ansible-doc -t inventory ansible.builtin.constructed
|
||||
#
|
||||
# Reproduce AWX behavior for constructed inventories
|
||||
|
||||
plugin: ansible.builtin.constructed
|
||||
strict: False
|
||||
|
||||
keyed_groups:
|
||||
- prefix: env
|
||||
key: environment_name
|
||||
parent_group: env
|
||||
|
||||
53
playbooks/hello.yml
Normal file
53
playbooks/hello.yml
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
|
||||
- name: Hello World
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
|
||||
pre_tasks:
|
||||
- name: Print debug message v1
|
||||
debug:
|
||||
msg: Hello, world!
|
||||
- name: Show groups
|
||||
debug:
|
||||
var: groups
|
||||
- name: get debug infos
|
||||
shell:
|
||||
cmd: |-
|
||||
ansible-galaxy collection list || true
|
||||
register: output1
|
||||
|
||||
- name: Show collections
|
||||
debug:
|
||||
var: output1
|
||||
- name: get debug infos
|
||||
shell:
|
||||
cmd: |-
|
||||
echo ID=$(id -u)
|
||||
echo PWD=$PWD
|
||||
git remote -v || true
|
||||
|
||||
register: output
|
||||
|
||||
- name: Local run context
|
||||
debug:
|
||||
var: output
|
||||
|
||||
|
||||
- name: Configure Web
|
||||
hosts: role_web
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: test1
|
||||
import_role:
|
||||
name: activia.infra_common.configure_web
|
||||
|
||||
- name: Configure DB
|
||||
hosts: role_db
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: test2
|
||||
import_role:
|
||||
name: activia.infra_common.configure_db
|
||||
|
||||
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
ansible==9.6.0
|
||||
5
requirements.yml
Normal file
5
requirements.yml
Normal file
@ -0,0 +1,5 @@
|
||||
collections:
|
||||
- name: https://git.jeznet.org/activia-tests/ansible-collection-infra-common.git
|
||||
type: git
|
||||
version: main
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user