[ansible-project] Re: Encrypted SSH Key leads to Invalid format

2022-10-02 Thread Dan Linder
Can you provide a minimal Ansible playbook with a vaulted variable file to see if we can recreate it or see anything amiss? The error message you're showing states "root @ SOME_IP: Permission denied (publickey,password)" which doesn't seem to be ansible-vault related. On Sunday, October 2,

[ansible-project] Re: Run playbook against multiple hosts with different variables

2022-03-04 Thread Dan Linder
Do you have an inventory file setup that has "server01" and "server02" setup in group(s)? For instance, instead of running the two examples above, setup an inventory file with both servers listed: # inventory.ini server01 server02 Then run your playbook like this: ansible-playbook

Re: [ansible-project] The "mount' module and adding a mount option

2022-01-20 Thread Dan Linder
> The only thing with this approach is that it explicitly sets all the flags > that are reported by ansible_mounts - but this might be a good idea anyway. > > Dick > > > On Tue, 18 Jan 2022 at 03:47, Dan Linder wrote: > >> I've got a variety of mounts that I want to ensure

[ansible-project] The "mount' module and adding a mount option

2022-01-17 Thread Dan Linder
I've got a variety of mounts that I want to ensure specific flags are set on each. For other reasons, the mounts don't have the same flags. I mistakenly thought the 'mount' module would ensure each had the flag, but instead it set the flags of the mount to ONLY the 'opts' parameter. For

[ansible-project] Re: Ansible and SELinux Issues

2021-12-09 Thread Dan Linder
In my environment, I found that we had to add the “remote_tmp” variable and make it unique per user. I think you’re running into the same thing if you look at the error message from that point of view: Permission denied: unix_listener: *cannot bind to path: /root*/.ansible/cp/ If it’s

Re: [ansible-project] Stouck in Ansible

2021-07-19 Thread Dan Linder
Abdul, If you're stuck as to how to ask the question, the StackOverflow "How do I ask a good question?" is a good reference. https://stackoverflow.com/help/how-to-ask Dan On Monday, July 19, 2021 at 2:51:02 AM UTC-5 dick@geant.org wrote: > This is almost zero information to help you

Re: [ansible-project] Stripping YAML dashes from output

2020-11-13 Thread Dan Linder
> Ultimately I'd like to figure out how to add a semicolon after each entry, This should do that; join with a semicolon not a newline: | join('; ') > then separate them into batches of 500 emails each Since you have the list already, you could use a `for` loop with an `if` test to insert a

Re: [ansible-project] Is it possible to SKIP task programmatically? Using callback module?

2020-11-02 Thread Dan Linder
What I've done for cases like this is use "when:" blocks on an include to pull in (or not) additional tasks. >From the 'include:' module : ``` - name: Include task list in play only if the condition is

Re: [ansible-project] Advice on build Immutable VM's ( VMware )

2020-10-28 Thread Dan Linder
On Tuesday, October 27, 2020 at 2:41:06 AM UTC-5 SP wrote: > An immutable vm in which servers are never modified after they’re > deployed. If something needs to be updated, fixed, or modified in any way, > new servers built from a common image with the appropriate changes are > provisioned to

Re: [ansible-project] Advice on build Immutable VM's ( VMware )

2020-10-26 Thread Dan Linder
I'll second @abhijeet and the use of the "vmware_guest" and "vmware_guest_sendkey" modules. It permits you to completely build your templates from a known ISO from your vendor (validated with a SHA256 checksum), using a kickstart file of your own, and no human interaction. And if the

Re: [ansible-project] Ansible tower issue

2020-10-11 Thread Dan Linder
I'm not trying to be snarky, but if you are truly "able to do it in the ansible cli with same user" then you wouldn't be receiving the error "rsync: change_dir \\"/opt/tibco/image\\" failed: Permission denied (13)" If this is as urgent as your messages are implying, you need to try some of the

Re: [ansible-project] deprecation of DEFAULT_HASH_BEHAVIOUR option

2020-09-27 Thread Dan Linder
I'll second ND that the hash_behavior option of "merge" is more usable in my situation - I have hashes of information that get built up in the playbook (one piece sets defaults for a location (i.e. "North America" vs "Europe" vs "Asia"), then a later part sets defaults for different

Re: [ansible-project] unistall windows server

2020-09-23 Thread Dan Linder
gt;>> - remove from dns >>> - remove ad object >>> - remove from backup job >>> - remove from monitoring >>> - delete vm from VMware >>> - update free ip list >>> - update cmdb >>> >>> >>> On Wed, 23

Re: [ansible-project] unistall windows server

2020-09-22 Thread Dan Linder
When I get to a point where I'm asking "How do I do X in Ansible", my first step is to make a checklist of what I would do if I was doing it manually. Assuming when you ask "Windows server uninstallation" you mean to remove the host from AD, remove it from DNS, delete files, etc., then start

Re: [ansible-project] Re: remove mysql

2020-07-16 Thread Dan Linder
The actions that those two tasks perform look to be the same, but you should update the "name:" field to better reflect that the job is removing/un-installing those packages. On Thursday, July 16, 2020 at 8:58:44 AM UTC-5 tdub...@gmail.com wrote: > control server is ubuntu 19.10 > client is

[ansible-project] Re: remove mysql

2020-07-15 Thread Dan Linder
> I tried this pb but its not uninstalling Can you be more specific? What version of Ansible are you using, what version of Debian/Ubuntu is the server you're working on? What is the output of this command when you run it on the machine you're wanting to remove the packages from: apt

Re: [ansible-project] run_once not working to register value of curl

2020-04-15 Thread Dan Linder
n plays in the > same playbook. I just want to know how to pass those variable to the next > play because it does not seem to be automatic. > > Thanks > > Il giorno ven 10 apr 2020 alle ore 23:41 Dan Linder > ha scritto: > >> So, from that output we know tha

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Dan Linder
-7.2.29.tar.gz", > "name": "PHP 7.2.29 (tar.gz)", > "sha256": > "ea5c96309394a03a38828cc182058be0c09dde1f00f35809622c2d05c50ee890" > }, > { > "date": "19 Mar 2020", > "filename": "php-7.2.29.ta

Re: [ansible-project] run_once not working to register value of curl

2020-04-10 Thread Dan Linder
Hi Nicola, I'd take a bit step back and reduce your playbook to just a couple of tasks: ``` - hosts: "{{ variable_host }}" serial: 1 tasks: - name: "Get PHP version from site" register: PHP_SITE_RESPONSE uri: body_format: json method: GET

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Dan Linder
I'd suggest putting a debug showing you the three numbers Ansible is using for item.size_total and item.size_available. As @klingac mentioned, it could be that the values that ""df -k" reports or uses in it's computation aren't the exact same ones that Ansible uses. For instance, using the

Re: [ansible-project] Ansible password_hash issue

2020-03-10 Thread Dan Linder
What is the error and what is sending the error? (i.e. is the error from "psql" or from Ansible itself?) Can you run the playbook with "-vvv" and paste in the errors the "Reset Admin pw" step produces. On Tuesday, March 10, 2020 at 11:12:17 AM UTC-5, Bala Mutyam wrote: > > Hi, > > Thanks for

[ansible-project] Re: Windows updates found but not installed

2020-02-29 Thread Dan Linder
I'd suggest removing the category_names and server_selection fields and see if the missing patches are applied. I don't do Windows patching, but it might be that the "sql server sp2 gdr" is in a different category or server selection. The "category_names" looks like it is a dynamic list that

[ansible-project] Re: Building a VM using Ansible Tower

2020-02-23 Thread Dan Linder
> I'm not sure if there is a difference in vmware_guest module for Tower or with versions. If the output is the same between Ansible Engine and Ansible Tower, then that would be my first though. Check the versions Tower and your test system are using and make sure Tower is the same version.

[ansible-project] Re: Windows updates found but not installed

2020-02-23 Thread Dan Linder
Can you include a simplified playbook showing the steps you're performing? Were the systems pending a reboot from a previous update? On Saturday, February 22, 2020 at 8:38:35 AM UTC-6, Andre Gronwald wrote: > > hi, > i tried to update some sql-servers with ansible (awx). > overall it worked

[ansible-project] Re: root user password needs to set for many servers however the password should be different password, not to be same

2019-09-18 Thread Dan Linder
Great to hear! Thanks for the feedback. On Wednesday, September 18, 2019 at 11:18:03 AM UTC-5, Deepan M wrote: > > Thank you Dan Linder, playbook is working perfect. > > Regards, > Deepan M > > On Tuesday, September 17, 2019 at 10:06:25 PM UTC+5:30, Deepan M wrote: >>

[ansible-project] Re: root user password needs to set for many servers however the password should be different password, not to be same

2019-09-17 Thread Dan Linder
If you're ok with Ansible generating the password for you then storing it on the machine you ran the playbook from, then the `password` plugin might help a bit. Assuming you have an inventory of servers and you're OK with saving the latest password to "/tmp/root.password.hostname.txt", I

Re: [ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Dan Linder
Dang! @Karl Auer beat me to this example. :) Depending on your needs and comfort level, here are two examples with sample output. The first "userlistA" is closer to your original example and has each list with a name that is not consistent with the server_type variable. That leads to the

[ansible-project] Re: Thoughts on Dynamic Variables

2019-08-30 Thread Dan Linder
A lot of our builds have site or subnet specific differences so we use Ansible facts to include specific YML files for either additional variables or branching the execution. For example, to choose the proper method to install VMware tools on our systems (RHEL 6 vs 7, and internet access or

[ansible-project] Re: best way to test for a condition and report it

2019-08-14 Thread Dan Linder
Ansible is really designed to put a system configuration into a state, so checking for a possible state is a bit trickier. But, you could run the playbook in check-only mode, then register the result of the change, then use the results "changed" flag in your script to get the report. For

[ansible-project] Re: set, read, and use vars from csv or csv2yml file

2019-08-04 Thread Dan Linder
What is the exact error message you're getting? I only slightly agree with Mr. Fellers response ("create a custom vars plugin"), but in your case that might be overkill. I've seen teams that have a developer write some custom code that breaks soon after he/she leaves and then they are stuck

Re: [ansible-project] using different remote_user until success

2019-07-09 Thread Dan Linder
On Monday, July 8, 2019 at 2:41:54 PM UTC-5, william...@gmail.com wrote: > > So, it will run include-3.yml 3 times? And one will succeed? > Yes - in my testing, I added a good user account to use, and that one ran the ping successfully. > I obviously have a number of tasks to run after

Re: [ansible-project] using different remote_user until success

2019-07-08 Thread Dan Linder
Are you opposed to using a second playbook and using the "include:" module like this? --- - hosts: all gather_facts: false tasks: - name: try users #remote_user: "{{ item }}" include: include-3.yml vars: my_remote_user: "{{ item }}" with_items: - centos -

[ansible-project] Re: Ansible usage of puppet "facter" not working in some hosts

2019-06-17 Thread Dan Linder
Since you have at least one working and one failing machine (presumably of the same OS version), can you compare the "rpm -qa" output and see what's different between the two just in case it's a simple package that was missing? On Sunday, June 16, 2019 at 2:10:04 PM UTC-5, Thomas Spear wrote:

[ansible-project] Merging of "win_*" with their non-OS specific siblings?

2019-05-28 Thread Dan Linder
Are there plans to merge the various Windows specific modules into their non-OS specific module twins? I'm thinking more of things like "win_ping", "win_copy", "win_command", "win_file", "win_shell", "win_tempfile", "win_template", "win_uri", "win_user", etc. There are plenty of Windows

[ansible-project] Re: How to use vars to work with to_datetime

2019-05-19 Thread Dan Linder
You're using the "debug:" module to set the "msg" variable so the date value isn't in the "{{ msg }}" variable, rather it's in the "{{ msg.msg }}" variable. Try these lines in stead: - name: FIXED - age of file in days stored in msg set_fact: msg: "{{ (ansible_date_time.epoch|int -

[ansible-project] Re: How to try one task in Ansible ?

2019-05-17 Thread Dan Linder
Your second question: > But when i run my script with module command or script or shell, the state > is changed but i'm not rassure if all task in my script is execut ...? When you use the `script:` module, anything that script does on your remote system is outside of the control of Ansible.

[ansible-project] Re: Delete based on directory size

2019-05-11 Thread Dan Linder
Does this help? I created a directory structure with four files: $ find /tmp/dirsize/ -ls | cut -c 18- drwxrwxr-x 5 dan dan 100 May 11 14:59 /tmp/dirsize/ drwxrwxr-x 2 dan dan60 May 11 15:00 /tmp/dirsize/d3 -rw-rw-r-- 1 dan dan 5242880 May 11

Re: [ansible-project] Re: don't print statement if "command not found" and compare variable value with list of values

2018-11-16 Thread Dan Linder
Correction to my previous email: You *COULD* run a play right before it that registers the full path of `systemctl` found on the system (maybe use `shell: which systemctl`), but that is not a stable method in some cases. I suggest using `systemd:` with the OS version check if needed. On Fri,

Re: [ansible-project] getting error when i set ssh-agent for root user

2018-09-30 Thread Dan Linder
t; - name: Add and load private key to ssh-agent > shell: "eval `ssh-agent -s` && ssh-add ~/.ssh/id_rsa" > > On Mon, Oct 1, 2018 at 2:26 AM Dan Linder wrote: > >> Hi Pranay, >> >> You asked, is "task i wrote in playbook in correct or not ?"

Re: [ansible-project] getting error when i set ssh-agent for root user

2018-09-30 Thread Dan Linder
The "ssh-agent" and "ssh-add" are usually run on a system as a specific user to add an SSH key to a temporary 'keychain' so any subsequent SSH commands can automatically (and without prompting) use a specific ssh key to connect to a second system. When you run them in the Ansible "shell"

Re: [ansible-project] Re: Source control of playbooks - how do you edit, test and perform version control....

2018-09-19 Thread Dan Linder
lders to separate the plays? > > Thanks in advance. Excuse typos... typed on mobile! > > On Thu, 26 Jul 2018, 3:00 PM Dan Linder, wrote: > >> I'll jump in with with what we are doing. >> >> We have a Git server (GitHub on site, but it could be any sourcecode >> r

[ansible-project] How to setup variable files to contain multiple versions of vaulted variables

2018-08-20 Thread Dan Linder
I'm running Ansible 2.6.2 and trying to wrap my head around the --vault-id and multiple vault passwords . As I understand it, the usefulness it is bringing is that different users can have

Re: [ansible-project] trying to reset root password by using .yml playbook, but its failed with permission denied error, however same .yml playbook is working via terminal.

2018-08-02 Thread Dan Linder
To save the call to the external Python command to encrypt the password, you can use the Jinja2 "password_hash" documented here: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#hashing-filters So your example could look like this: - name: changing root

Re: [ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
I've run into subtle and hard-to-spot logic bugs (Ansible and elsewhere) that were 'correct' but magically solved when rewritten. I agree that your syntax looks spot on, but breaking it out into multiple statements might make it easier to troubleshoot later on too. Glad it worked! On Sun, May

[ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
ignore_errors: yes On Sunday, May 27, 2018 at 12:00:17 PM UTC-5, Dan Linder wrote: > > The "when" stanza performs a AND when there are multiple when conditions ( > http://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#the-when-statement > ). > >

[ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
The "when" stanza performs a AND when there are multiple when conditions (http://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#the-when-statement). Whenever I encounter a problem with 'when' I try to break it up to multiple lines so the numerous parenthesis aren't

[ansible-project] Re: Vault and "dictionaries" - bug or feature request?

2017-10-16 Thread Dan Linder
ot;List variable" debug: msg: "name: {{item}}, password: {{item.password}}" with_items: "{{ userlist.values() | list }}" On Wednesday, October 11, 2017 at 9:24:57 PM UTC-5, Dan Linder wrote: > I've have a dictionary variable setup that has accounts and

[ansible-project] Vault and "dictionaries" - bug or feature request?

2017-10-11 Thread Dan Linder
I've have a dictionary variable setup that has accounts and passwords: password_list: - { name: "user1", password: "user1pwd" } - { name: "user2", password: "user2pwd" } - { name: "user3", password: "user3pwd" } This

Re: [ansible-project] Ansible "file" module and attributes in 2.3.1.0

2017-07-23 Thread Dan Linder
Thanks Kai, hadn't thought about using the attr_flags field - I'll give it a shot when I get back to that issue. Dan On Sat, Jul 22, 2017 at 9:34 AM, Kai Stian Olstad < ansible-project+l...@olstad.com> wrote: > On 21.07.2017 17:34, Dan Linder wrote: > >> I setup a playb

[ansible-project] Ansible "file" module and attributes in 2.3.1.0

2017-07-21 Thread Dan Linder
I've got a set of systems that have a configuration file with the "immutable" flag set on them by a previous setup process. The "lsattr /etc/security/access.conf" on a RHEL 6 system shows the "i" flag set. Manually doing a "chattr -i /etc/security/access.conf" removes the flag, but I'd like

Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I'm falling back to the six tasks for now (three stat file, three include when exists). In my mind this is a bug; the "ignore_errors" setting should let it keep the partial result. The parallel being that the file module could partially succeed in setting a file owner but SELinux or other

Re: [ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I forgot to add that I've defined the hash_behaviour to "merge" just for this express purpose of keeping and stacking/appending variables so the normal behavior is suppose to be modified here. On Monday, July 10, 2017 at 2:59:22 PM UTC-5, Brian Coca wrote: > > Well, when you include_vars you

[ansible-project] Using include_vars and with_items with optiona files == bug?

2017-07-10 Thread Dan Linder
I'm trying to setup a hierarchical set of variable files so that different teams can setup value, permitting more specific instances to override generic ones. The key is that the more specific instances may not be defined in all cases. I thought I solved it with a combination of

[ansible-project] Roles, vars, defaults, and pre_tasks.

2017-03-09 Thread Dan Linder
I'm trying to split up a large playbook into roles and it's going pretty well except I'm having trouble with variables not being pulled in from the roles vars or defaults files. My playbook has this test playbook with a pre_task: --- - hosts: all # vars: #doreboots: true #