robertdebock / ansible-role-common Goto Github PK
View Code? Open in Web Editor NEWThe purpose of this role is to configure common things on your system.
Home Page: https://robertdebock.nl/
License: Apache License 2.0
The purpose of this role is to configure common things on your system.
Home Page: https://robertdebock.nl/
License: Apache License 2.0
I would like to be able to run common role without changing nameservers, but it is currently not possible because I get the following error message when I set the variable common_nameservers to an empty array:
Fatal: [asr-vm-rundeck]: FAILED! => {"assertion": "common_nameservers | length > 0", "changed": false, "evaluated_to": false, "msg": "Assertion failed"}
Why is this feature required?
Not in all cases it is desired to replace name servers.
Describe the bug
fatal: [HOST]: FAILED! => {"msg": "The conditional check 'update_reboot' failed. The error was: error while evaluating conditional (update_reboot): 'update_reboot' is undefined\n\nThe error appears to have been in 'roles/robertdebock.common/handlers/main.yml': line 7, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: reboot for hostname\n ^ here\n"}
Copy-pasted from the update role, needs a fix.
To Reproduce
Steps to reproduce the behavior:
Hi
Looks like the collection is missing the template of the hosts file:
TASK [robertdebock.roles.common : fill /etc/hosts] *****************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [foo1]: FAILED! => changed=false
msg: |-
Could not find or access 'hosts.j2'
Searched in:
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/templates/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/hosts.j2 on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [foo2]: FAILED! => changed=false
msg: |-
Could not find or access 'hosts.j2'
Searched in:
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/templates/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/hosts.j2 on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [foo3]: FAILED! => changed=false
msg: |-
Could not find or access 'hosts.j2'
Searched in:
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/templates/hosts.j2
/Users/tdeutsch/.ansible/collections/ansible_collections/robertdebock/roles/roles/common/tasks/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/templates/hosts.j2
/Users/tdeutsch/git/k8s-server/ansible/plays/hosts.j2 on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
I downloaded the collection today.
Br
Thomas
- role: robertdebock.common
common_update_hosts: false
ansible_default_ipv4
Allow to declare different interface to be used for the addresses:
- role: robertdebock.common
common_interface: ens6
This is required when hosts have a dedicated management (ansible) interface as their default interface.
Example: This is most often the case when using molecule_vagrant with libvirt for instance and additional public network on a separate bridge device.
Clustered production systems most of the time have dedicated interfaces for cluster traffic.
Example: External services (dns/dhcp) might provide necessary address information. It would be required that hosts file is not written at all.
Relevant sample snippet from molecule.yml :
driver:
name: vagrant
provider:
name: libvirt
platforms:
- name: db11${_TEST_DOMAIN:-.in.ndgit.com}
box: almalinux/8
memory: 8192
cpus: 4
interfaces:
- network_name: public_network
dev: "${_TEST_BRIDGE_DEV:-virbr0}"
type: "bridge"
mode: "bridge"
groups:
- pxc
...
Relevant sample snippet from ansible facts as an example:
{
"ansible_default_ipv4": {
"address": "192.168.122.198",
"alias": "ens5",
"broadcast": "192.168.122.255",
"gateway": "192.168.122.1",
"interface": "ens5",
"macaddress": "52:54:00:c6:2d:38",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "192.168.122.0",
"type": "ether"
},
"ansible_ens5": {
"ipv4": {
"address": "192.168.122.198",
"broadcast": "192.168.122.255",
"netmask": "255.255.255.0",
"network": "192.168.122.0"
}
},
"ansible_ens6": {
"ipv4": {
"address": "192.168.5.10",
"broadcast": "192.168.5.255",
"netmask": "255.255.255.0",
"network": "192.168.5.0"
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.