Skip to content

Instantly share code, notes, and snippets.

View Kickimanjaro's full-sized avatar

Kickimanjaro

  • Fort Collins, CO
View GitHub Profile
@Kickimanjaro
Kickimanjaro / mount-devpts.yaml
Last active April 17, 2022 00:29
I am having trouble making the mount command here idempotent. I think it should work the way I've written it, but it isn't.
---
# I want to verify that /dev/pts is mounted, and if not, mount it.
# Manually, this is simply: mount devpts /dev/pts -t devpts
# I want the resulting playbook to be idempotent and support the --check flag
- hosts: test
remote_user: testroot
tasks:
# The simple "command" way to do this.
@Kickimanjaro
Kickimanjaro / keepalived.conf.j2
Last active March 21, 2021 01:01
This creates a list of all the IP addresses I want from a hostgroup. I want to exclude the local host from this list on each node. Is this possible in the template file or must I combine with another task to remove the unwanted value?
...
unicast_peer {
{% for host in groups['loadbalancers'] %}
{{ hostvars[host]['ansible_default_ipv4']['address'] }}
{% endfor %}
}
...