Re: [ansible-project] How to Use Ansible to Determine differing features of a Machine

2018-05-19 Thread Andy Smith
Hello, On Fri, May 18, 2018 at 03:30:31PM -0700, Carlton Patterson wrote: > Can someone let me know how to use ansible to determine the differences > between two machines. Have a look at all the facts that ansible knows about a host by running: $ ansible target-hostname -m setup If there is

Re: [ansible-project] Copy files with hostname to respective hosts

2018-05-03 Thread Andy Smith
Hello, On Thu, May 03, 2018 at 03:51:50AM -0700, Uday Medhi wrote: > host1.zip -to-> host1 > host2.zip -to-> host2 > host3.zip -to-> host3 > > I want ansible to look into the directory "deploy", check the files, match > it with the hostnames and copy to the respective

[ansible-project] Filtering a nested structure in Jinja2, regexp matches?

2018-04-29 Thread Andy Smith
Hi, I'd like to produce a template which lists disk device links. These are the things you might find in /dev/disk/by-id/*, e.g.: $ ls /dev/disk/by-id ata-SomeVendor_-5_BB ata-ST4000LM016-1N2170_W801ZG92 ata-OtherVendor_SSD_OVCC

Re: [ansible-project] Filtering a nested structure in Jinja2, regexp matches?

2018-04-29 Thread Andy Smith
Hi Kai, On Sun, Apr 29, 2018 at 11:48:09AM +0200, Kai Stian Olstad wrote: > On 29.04.2018 10:32, Andy Smith wrote: > >- Is there any way to do a regexp match? I am concerned that without > > anchoring the "ata-" at the start or including the digits of the > > &

Re: [ansible-project] Re: Remove missing files from a list

2018-04-05 Thread Andy Smith
Hi, On Wed, Apr 04, 2018 at 02:56:39PM -0700, flowerysong wrote: > On Wednesday, April 4, 2018 at 4:43:14 PM UTC-4, Andy Smith wrote: > > https://gist.github.com/grifferz/a505e352baa18e06ba1ba1d02a123ee2 > > > > This works, but have I missed something which a

[ansible-project] Remove missing files from a list

2018-04-04 Thread Andy Smith
Hi, Imagine a service foo that has a config file /etc/foo/files_of_interest which is just a list of other file paths, one per line. If you put a path that doesn't exist into the file then the service foo complains about it regularly, so you'd better not do that. I'd like to provide a default

Re: [ansible-project] Tagging all imported tasks

2018-11-28 Thread Andy Smith
Hi Kai, On Thu, Nov 29, 2018 at 06:41:03AM +, Andy Smith wrote: > On Thu, Nov 29, 2018 at 07:17:06AM +0100, Kai Stian Olstad wrote: > > Since you are setting the tag on the role in the play, you don't need to tag > > it here again. > > If I leave out the "tag

Re: [ansible-project] Tagging all imported tasks

2018-11-28 Thread Andy Smith
Hi Kai, On Thu, Nov 29, 2018 at 07:17:06AM +0100, Kai Stian Olstad wrote: > On 29.11.2018 06:21, Andy Smith wrote: > >If I add a tag attribute to each of those imports, i.e.: > > > >- import_tasks: configure_this.yml tags=some_server > >- import_tasks: creat

[ansible-project] Tagging all imported tasks

2018-11-28 Thread Andy Smith
Hi, Is there a way to apply a tag to all of the import_tasks statements in a role's tasks/main.yml file without stating it on every import_tasks line? That is, given a directory structure a bit like this: . ├── roles │   ├── some_server │   │   └── tasks │   │   ├── configure_this.yml │   │ 

[ansible-project] Build file from two other files

2018-12-08 Thread Andy Smith
Hi, I feel I must be missing something very obvious here, but I can't find it, so here we go. Let's say I've got a role's tasks/main.yml that includes some other tasks on a loop: - include_tasks: distribute_thing.yml when: thing_names is defined loop: "{{ thing_names | flatten(levels=1) }}"

Re: [ansible-project] Build file from two other files

2018-12-08 Thread Andy Smith
On Sat, Dec 08, 2018 at 01:30:00PM +, Andy Smith wrote: > Probably I missed some really simple way to just concat a bunch of > files together and send that over. Is there something like that? Typical, as soon as I ask the question I find a way to do it: - name: Rebuild foobar file

Re: [ansible-project] Problems notifying handlers in another role

2018-12-08 Thread Andy Smith
le handlers that do the same thing and also > allows me to enforce the order that they are run (eg, I have a reboot > handler that would be really counterproductive if it ran before other > handlers, so it is listed last). > > On Sat, Dec 8, 2018, 9:52 AM Andy Smith > > Hello,

Re: [ansible-project] Run a task only on remote host if this hosts a specific database

2018-12-09 Thread Andy Smith
Hi Christian, On Sun, Dec 09, 2018 at 08:06:28AM -0800, Christian Marquardt wrote: > - Having local facts defined on remote machine containing a list of > databases running on this host > - Having local list of host-database-relationship on the ansible host itself > > Does anyone of you have an

[ansible-project] Problems notifying handlers in another role

2018-12-08 Thread Andy Smith
Hello, Say I have a playbook a bit like this: - hosts: some_group roles: - { role: app, } - hosts: all roles: - { role: configure, } That second role "configure" does something that will require the apache2 service on hosts in some_group to be

[ansible-project] Stopping at first change

2019-06-13 Thread Andy Smith
Hi, Is there a way, without modifying the playbooks, to make ansible-playbook stop at/after the first change but carry on through any tasks that don't make changes? My intent is to run it in --check and --diff mode against infrastructure to see that all the nodes are correctly configured, but if

Re: [ansible-project] Re: "10" compares as older than "10.0" with version()

2021-09-15 Thread Andy Smith
Hello, On Wed, Sep 15, 2021 at 10:52:23AM +0200, Dick Visser wrote: > Instead of trying to make (to me rather arbitrary) comparisons between > 10 and 10.0, I'd investigate why ansible_distribution_version for your > OS has no 'decimals' to begin with. I think it's because none of the point

Re: [ansible-project] Re: "10" compares as older than "10.0" with version()

2021-09-15 Thread Andy Smith
Hello, On Wed, Sep 15, 2021 at 07:54:44PM +, Andy Smith wrote: > On Wed, Sep 15, 2021 at 10:52:23AM +0200, Dick Visser wrote: > > Instead of trying to make (to me rather arbitrary) comparisons between > > 10 and 10.0, I'd investigate why ansible_distribution_version for

[ansible-project] "10" compares as older than "10.0" with version()

2021-09-14 Thread Andy Smith
Hi, My ansible_distribution_version returns "10". This debug fires: - name: version 10 < 10.0 ansible.builtin.debug: msg: - "I think 10 is older than 10.0" when: {{ ansible_distribution_version }} is version('10.0', '<') python 3.9.7, ansible 2.10.14. Any way around this without

Re: [ansible-project] Re: "10" compares as older than "10.0" with version()

2021-09-15 Thread Andy Smith
Hello, On Tue, Sep 14, 2021 at 05:49:44PM -0700, flowerysong wrote: > On Tuesday, September 14, 2021 at 7:20:59 PM UTC-4 Andy Smith wrote: > > > My ansible_distribution_version returns "10". This debug fires: > > > > - name: version 10 < 10.0 > >

Re: [ansible-project] create a systemd service without write access to /etc/systemd/system

2022-09-01 Thread Andy Smith
Hi, On Thu, Sep 01, 2022 at 07:15:42AM +0200, dulhaver via Ansible Project wrote: > the challenge I am facing is that the only way to do this manually > is via > >sudo systemctl edit --full postgresql@[db_service_name].service If you can use sudo then can you not just do the equivalent of

Re: [ansible-project] Incomprehensible error message

2024-01-18 Thread Andy Smith
Hi Ian, On Thu, Jan 18, 2024 at 11:47:46AM +0700, Ian Hobson wrote: > community.mysql.mysql_user: > user: backup > host: localhost > login_password: > priv: '*.*:SELECT, PROCESS, LOCK TABLES' > > The error message is: > fatal: [ubuntu2004.hcs]: FAILED! => {"changed": false,