From 70ea55249bfc7223dc30f2e3e257f2cf258e0e1d Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Tue, 5 Nov 2024 13:01:51 +0530 Subject: [PATCH 1/2] Add test and production inventory group to the playbook project --- .vscode/settings.json | 3 ++- .../inventory/group_vars/db_servers.yml.j2 | 3 +++ .../inventory/group_vars/production.yml.j2 | 3 +++ .../playbook_project/inventory/group_vars/test.yml.j2 | 3 +++ .../resources/playbook_project/inventory/hosts.yml.j2 | 8 ++++++++ .../playbook_project/inventory/group_vars/db_servers.yml | 3 +++ .../playbook_project/inventory/group_vars/production.yml | 3 +++ .../playbook_project/inventory/group_vars/test.yml | 3 +++ .../fixtures/project/playbook_project/inventory/hosts.yml | 8 ++++++++ 9 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/ansible_creator/resources/playbook_project/inventory/group_vars/db_servers.yml.j2 create mode 100644 src/ansible_creator/resources/playbook_project/inventory/group_vars/production.yml.j2 create mode 100644 src/ansible_creator/resources/playbook_project/inventory/group_vars/test.yml.j2 create mode 100644 tests/fixtures/project/playbook_project/inventory/group_vars/db_servers.yml create mode 100644 tests/fixtures/project/playbook_project/inventory/group_vars/production.yml create mode 100644 tests/fixtures/project/playbook_project/inventory/group_vars/test.yml diff --git a/.vscode/settings.json b/.vscode/settings.json index e92207d0..6e93fb12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,5 +25,6 @@ "sonarlint.connectedMode.project": { "connectionId": "ansible", "projectKey": "ansible_ansible-creator" - } + }, + "ansible.python.interpreterPath": "/Users/shamishr/.pyenv/versions/3.12.0/envs/c1/bin/python" } diff --git a/src/ansible_creator/resources/playbook_project/inventory/group_vars/db_servers.yml.j2 b/src/ansible_creator/resources/playbook_project/inventory/group_vars/db_servers.yml.j2 new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/src/ansible_creator/resources/playbook_project/inventory/group_vars/db_servers.yml.j2 @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/src/ansible_creator/resources/playbook_project/inventory/group_vars/production.yml.j2 b/src/ansible_creator/resources/playbook_project/inventory/group_vars/production.yml.j2 new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/src/ansible_creator/resources/playbook_project/inventory/group_vars/production.yml.j2 @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/src/ansible_creator/resources/playbook_project/inventory/group_vars/test.yml.j2 b/src/ansible_creator/resources/playbook_project/inventory/group_vars/test.yml.j2 new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/src/ansible_creator/resources/playbook_project/inventory/group_vars/test.yml.j2 @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 b/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 index 59779b88..7d76e4a6 100644 --- a/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 +++ b/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 @@ -22,3 +22,11 @@ all: hosts: switch1: switch2: + production: + hosts: + server1: + server2: + test: + hosts: + server1: + server2: diff --git a/tests/fixtures/project/playbook_project/inventory/group_vars/db_servers.yml b/tests/fixtures/project/playbook_project/inventory/group_vars/db_servers.yml new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/tests/fixtures/project/playbook_project/inventory/group_vars/db_servers.yml @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/tests/fixtures/project/playbook_project/inventory/group_vars/production.yml b/tests/fixtures/project/playbook_project/inventory/group_vars/production.yml new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/tests/fixtures/project/playbook_project/inventory/group_vars/production.yml @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/tests/fixtures/project/playbook_project/inventory/group_vars/test.yml b/tests/fixtures/project/playbook_project/inventory/group_vars/test.yml new file mode 100644 index 00000000..9fafc14f --- /dev/null +++ b/tests/fixtures/project/playbook_project/inventory/group_vars/test.yml @@ -0,0 +1,3 @@ +--- +http_port: 80 +app_version: "1.0.0" diff --git a/tests/fixtures/project/playbook_project/inventory/hosts.yml b/tests/fixtures/project/playbook_project/inventory/hosts.yml index 59779b88..7d76e4a6 100644 --- a/tests/fixtures/project/playbook_project/inventory/hosts.yml +++ b/tests/fixtures/project/playbook_project/inventory/hosts.yml @@ -22,3 +22,11 @@ all: hosts: switch1: switch2: + production: + hosts: + server1: + server2: + test: + hosts: + server1: + server2: From 8782a3758e11eb19d6fee35709a92d16cb174e69 Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Thu, 7 Nov 2024 11:31:24 +0530 Subject: [PATCH 2/2] changes in the inventory file --- .vscode/settings.json | 3 +-- .../resources/playbook_project/inventory/hosts.yml.j2 | 6 ++++-- tests/fixtures/project/playbook_project/inventory/hosts.yml | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6e93fb12..e92207d0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,5 @@ "sonarlint.connectedMode.project": { "connectionId": "ansible", "projectKey": "ansible_ansible-creator" - }, - "ansible.python.interpreterPath": "/Users/shamishr/.pyenv/versions/3.12.0/envs/c1/bin/python" + } } diff --git a/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 b/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 index 7d76e4a6..e3f96426 100644 --- a/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 +++ b/src/ansible_creator/resources/playbook_project/inventory/hosts.yml.j2 @@ -25,8 +25,10 @@ all: production: hosts: server1: + ansible_host: 192.168.1.101 server2: + ansible_host: 192.168.1.102 test: hosts: - server1: - server2: + server3: + ansible_host: 192.168.1.103 diff --git a/tests/fixtures/project/playbook_project/inventory/hosts.yml b/tests/fixtures/project/playbook_project/inventory/hosts.yml index 7d76e4a6..e3f96426 100644 --- a/tests/fixtures/project/playbook_project/inventory/hosts.yml +++ b/tests/fixtures/project/playbook_project/inventory/hosts.yml @@ -25,8 +25,10 @@ all: production: hosts: server1: + ansible_host: 192.168.1.101 server2: + ansible_host: 192.168.1.102 test: hosts: - server1: - server2: + server3: + ansible_host: 192.168.1.103