Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update ansible-do generator playbook to use dzangolab ansible collection #27

Merged
merged 4 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion generators/ansible-do/templates/ansible/stack/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ host_key_auto_add = True
host_key_checking = False
inventory = ./hosts
retry_files_save_path = ./.ansible-retry
roles_path = ./roles
2 changes: 1 addition & 1 deletion generators/ansible-do/templates/ansible/stack/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ docker.data-folder:

install:
@printf "\033[0;32m>>> Install ansible roles\033[0m\n"
ansible-galaxy install -r requirements.yml --force
ansible-galaxy collection install dzangolab.ansible --force
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collections can be listed in requirements.txt. See https://docs.ansible.com/ansible/latest/collections_guide/collections_installing.html#collection-requirements-file. This is ultimately more flexible than hard-coding the collection to install in the makefile. (the makefile is only a convenience tool, it should not contain any logic)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, changes has been made.


portainer.down:
@printf "\033[0;32m>>> Set up portainer\033[0m\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@

- name: Install aws-cli
hosts: awscli
collections:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where you found this syntax.
I have found instead that the FQN of the role should be used. see https://docs.ansible.com/ansible/latest/collections_guide/collections_using_playbooks.html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, changes has been made.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried using the module syntax but did not worked

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax you proposed is only usable for module and therefore doesn't work for a role wich we have, it is technically possible to change a role into a module to some degrees but just for syntax preferences it is too much work for what it would benefit.

- dzangolab.ansible
roles:
- role: dzangolab.awscli2
- awscli2
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

- name: Deploy portainer
hosts: all
collections:
- dzangolab.ansible
roles:
- role: dzangolab.docker_portainer
- docker_portainer
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

- name: Deploy traefik
hosts: traefik
collections:
- dzangolab.ansible
roles:
- role: dzangolab.docker_traefik
- docker_traefik
vars:
- traefik__dashboard_basicauth_passwords: ["{{ traefik_dashboard_basicauth_password.stdout }}"]

This file was deleted.