Re: [ansible-project] Ansible and aureport

2024-05-09 Thread John Harmon
failed syscalls: 0' > - 'Number of anomaly events: 0' > - 'Number of responses to anomaly events: 0' > - 'Number of crypto events: 0' > - 'Number of integrity events: 0' > - 'Number of virt events: 0' > - 'Number of keys

[ansible-project] Re: ansible Loop help

2024-05-08 Thread John Harmon
You mean something like this? - name: Run status check pps_check: vm_ip: "{{ item }}" url: "https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list="; register: status_check with_items: "{{ available_ips }}" async: 900 # Adjust the timeout based

[ansible-project] Re: Create a variable based on a variable

2024-05-08 Thread John Harmon
Just off the top of my head you can use set_fact. - name: Set datacenter variable based on hostname set_fact: datacenter: "datacenter{{ ansible_hostname[-1] }}" when: ansible_hostname | regex_search('^[a-zA-Z0-9]*[1-2]') You can then just use {{ datacenter }} and it should populate correct

[ansible-project] Ansible and aureport

2024-05-08 Thread John Harmon
I am running this in my task file (tried shell, command, and raw). Any idea why and how to work around the issue?: - name: Check number of AVCs ansible.builtin.raw: "aureport | grep -i avc" register: avcreport - debug: var: avcreport It returns a report with all zero values, but if I r

[ansible-project] Assert that fails with list

2022-12-19 Thread John Harmon
I have the following assert that works when I specify a single user in my variable/list 'username'. If I change my variable to a list of names, this fails, but I don't understand how to fix it. I have tried multiple things (ie with_items), but nothing is working for me. I am sure I just have

[ansible-project] Register var from copy buffer

2022-08-30 Thread John Harmon
I have a command that I run on my local machine. It doesn't send anything to screen, rather, it just copies some content to my copy buffer. I would like to register the buffer content to a variable. How can I do this? -- You received this message because you are subscribed to the Google Gro

[ansible-project] Run excel VB or Macro?

2020-01-24 Thread John Harmon
I am trying to automate a process. Is it possible, natively in Ansible, to run an Excel Macro, or Visual Basic code against an .csv? Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] archive: "file.zip" does not exist

2019-11-15 Thread John Harmon
On Friday, November 15, 2019 at 9:40:49 AM UTC-7, Kai Stian Olstad wrote: > > On Fri, Nov 15, 2019 at 08:37:43AM -0800, John Harmon wrote: > > No, it doesn't. It is on my laptop. Was hoping to zip it up locally > > Then you need to set your playbook to local

Re: [ansible-project] archive: "file.zip" does not exist

2019-11-15 Thread John Harmon
No, it doesn't. It is on my laptop. Was hoping to zip it up locally On Friday, November 15, 2019 at 8:27:35 AM UTC-7, Sam Doran wrote: > > John, > > The value for path must exist on the remote machine. Does > /Users/joharmon/Desktop/LookingGlass_Reports_2019-11-14/wargames_reports > exist on t

[ansible-project] archive: "file.zip" does not exist

2019-11-14 Thread John Harmon
I have the following: - name: Compress reports archive: path: "{{ final_location }}/{{ host }}_reports" #dest: "{{ final_location }}/{{ host }}_reports.zip" format: zip It returns this: TASK [LookingGlass : Compress reports]

Re: [ansible-project] What approach should I take with this loop?

2019-11-14 Thread John Harmon
On Thursday, November 14, 2019 at 1:59:18 PM UTC-7, Vladimir Botka wrote: > > On Thu, 14 Nov 2019 11:41:51 -0800 (PST) > John Harmon > wrote: > > > The following fails for sure, but you get the idea of what I am trying > to > > do. How might I be able

[ansible-project] What approach should I take with this loop?

2019-11-14 Thread John Harmon
The following fails for sure, but you get the idea of what I am trying to do. How might I be able to loop this? Problem is with 'searchme' and probably trying to do something you can't do - name: Set fact based on host set_fact: log_source: "{{ item.src }}" when: "ansible_hostname is s

Re: [ansible-project] Re: Parsing a csv file

2019-11-13 Thread John Harmon
Matt, thank you! I took what you gave me and finished off with this, which gives me what I need. - name: Write error log lineinfile: line: "{{ item.ErrorMessage }}" path: /tmp/errors.txt insertafter: EOF delegate_to: localhost loop: "{{ errors.list }}" This ends up writing e

[ansible-project] Re: Parsing a csv file

2019-11-08 Thread John Harmon
This does it in bash, but I am trying to avoid scripting it: awk -F "\"*,\"*" '{print $2}' my.csv Results: resource has no content Blocked until the other thread finished using this session not found not found not found resource has no content -- You received this message because you are subsc

[ansible-project] Re: Parsing a csv file

2019-11-08 Thread John Harmon
If I run the following I can pull back the key value pair for the first item in the list: - debug: var: errors.list.1.ErrorMessage I just need every item in the list, and hopefully just the values -- You received this message because you are subscribed to the Google Groups "Ansible Project

[ansible-project] Parsing a csv file

2019-11-08 Thread John Harmon
I would like to parse a CSV. I need the column with the header 'ErrorMessage'. I am reading the variable and gathering the information, but I don't know how to pull out the info I need form the results: - name: Parse LookingGlass Report for Errors read_csv: path: /etc/ansible/roles/Look

Re: [ansible-project] Simple assert failure

2019-11-08 Thread John Harmon
also: > > - user is not none > > On Fri, Nov 8, 2019 at 3:13 PM John Harmon > wrote: > >> Simple, but I can't figure it out. The following doesn't appear to be >> working. Wondering if I have a syntax error? >> >> - assert: >> that

[ansible-project] Simple assert failure

2019-11-08 Thread John Harmon
Simple, but I can't figure it out. The following doesn't appear to be working. Wondering if I have a syntax error? - assert: that: - user is defined msg: "Be sure to define the username under defaults/main.yml" Whether it is defined or not in the defaults/main.yml it produces the

[ansible-project] Re: Ansible, and openssh on Windows 10

2019-05-23 Thread John Harmon
I am assuming it isn't quite baked yet. The ControlPath and other things look to be all linux-based (ie. /bin/sh). TASK [Gathering Facts]

[ansible-project] Ansible, and openssh on Windows 10

2019-05-23 Thread John Harmon
Just messing around, but I setup openssh on Windows 10. My administrative user, john, is configured with the public key for my root user from the ansible server. I can ssh from ansible to windows 10 without a password, and things look fine. When trying a simple playbook, however, I get failu

Re: [ansible-project] set_fact not working with when condition

2019-04-24 Thread John Harmon
t > 6 > > or > > when: ansible_distribution_major_version is version('6', 'gt') > > > > https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#version-comparison > > On Wed, Apr 24, 2019 at 4:56 PM John Harmon > wrote: > >> I have a role, an

Re: [ansible-project] Installing packages from variable

2019-04-24 Thread John Harmon
On Thursday, April 18, 2019 at 10:11:49 AM UTC-6, Brian Coca wrote: > > There is no specific docs about what is a list in each module as in > general we accept [x, y, z] AND "x, y, z" everywhere we say 'list'. > > But it does seem to be a bug in not 'trimming' the list elements, > which might

[ansible-project] set_fact not working with when condition

2019-04-24 Thread John Harmon
I have a role, and in the *defaults/main.yml* I have the following variable set: --- firewall: iptables In my playbook I have the following: - name: Set firewall service name set_fact: firewall: firewalld when: ansible_distribution_major_version > 6 Unfortunately version 6 and 7 rhel-ba

[ansible-project] Re: How to execute a playbook before a role?

2019-04-04 Thread John Harmon
Thanks Brian! -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-proj

[ansible-project] How to execute a playbook before a role?

2019-04-04 Thread John Harmon
This doesn't work of course, but shows what I am trying to do. I wish to call a playbook before a couple of roles. How might I do this? Doesn't work, but is an explanatory example: --- - hosts: "{{ host }}" pre_tasks: - name: Import gitlab playbook import_playbook: /etc/ansible/playbo

[ansible-project] Installing packages from variable

2019-03-27 Thread John Harmon
I am installing packages from a variable, which works fine with yum; however, with apt I am having issues unless I change the format of the variable. Perhaps apt still allows you to use "with_items" unlike yum (which complains that the loop is deprecated in favor of a variable)? I haven't tes

Re: [ansible-project] Re: replace module regexp with newline character

2019-03-22 Thread John Harmon
On Friday, March 22, 2019 at 11:23:15 AM UTC-6, John Harmon wrote: > > You are right I switched to lineinfile sometime between yesterday and > today. I switched back to replace due to your success (and I prefer to use > it as I believe it will replace all found instances).

Re: [ansible-project] Re: replace module regexp with newline character

2019-03-22 Thread John Harmon
You are right I switched to lineinfile sometime between yesterday and today. I switched back to replace due to your success (and I prefer to use it as I believe it will replace all found instances). Seems to be working now, however, one follow-up question regarding backrefs. I thought \1

Re: [ansible-project] Re: replace module regexp with newline character

2019-03-22 Thread John Harmon
Thx Kai. I tried it, and the regexp test shows that the regexp is good, but it doesn't replace the line. It just says ok, and continues on. Here is my slightly modified variant also doing the same thing (or to be more specific, not doing anything): regexp: 'nameservers:\n.*addresses:.*\

Re: [ansible-project] Re: replace module regexp with newline character

2019-03-22 Thread John Harmon
On Thursday, March 21, 2019 at 2:46:50 PM UTC-6, Kai Stian Olstad wrote: > > On 21.03.2019 20:51, John Harmon wrote: > > > > Thx all. Those helped. I now get it to replace, but it replaces my > string > > and not just my backref. Not sure what I am doing

Re: [ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon
On Thursday, March 21, 2019 at 12:11:00 PM UTC-6, Kai Stian Olstad wrote: > > On 21.03.2019 18:10, John Harmon wrote: > > I have tried single quotes too around the regexp, but get a similar > issue > > > > TASK

[ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon
I have tried single quotes too around the regexp, but get a similar issue TASK [dns_update : include_tasks] *

[ansible-project] Re: replace module regexp with newline character

2019-03-21 Thread John Harmon
Sorry, last error message is slightly innaccurate I was testing a change in that one (difference is brackets [ ]): TASK [dns_update : include_tasks] **

[ansible-project] replace module regexp with newline character

2019-03-21 Thread John Harmon
I need to use replace to find a regexp that includes \n; however, I keep getting an error. How can I properly do this (don't even know if I am using back reference correct either, but if I can get past this error I think I can figure that part out)? Thanks in advance! --- # DNS Update For Ubun

[ansible-project] Re: Encrypted passwords not working, clear text does

2019-03-12 Thread John Harmon
On Tuesday, March 12, 2019 at 3:09:48 PM UTC-6, Jordan Borean wrote: > > The encrypt part of prompt is to create an encrypted/hash value of the > prompt, as you can see the output is useless and it will be used literally > causing the auth to fail. This is useful for modules that work with the

[ansible-project] Encrypted passwords not working, clear text does

2019-03-12 Thread John Harmon
For my credssp (windows) to work, I need ansible_user and ansible_password set. I can set these in plain text in a variable, and everything works fine; however, when experimenting with vars_prompt I attempt the same thing and fails when I use encryption. If I store the password as I do the ad

Re: [ansible-project] expect with duplicated responses

2019-03-01 Thread John Harmon
On Friday, March 1, 2019 at 3:05:20 PM UTC-7, Kai Stian Olstad wrote: > > On 01.03.2019 22:56, John Harmon wrote: > > > > > > On Friday, March 1, 2019 at 2:55:13 PM UTC-7, Kai Stian Olstad wrote: > >> > >> On 01.03.2019 22:47, John Harmon wrote:

Re: [ansible-project] expect with duplicated responses

2019-03-01 Thread John Harmon
On Friday, March 1, 2019 at 2:55:13 PM UTC-7, Kai Stian Olstad wrote: > > On 01.03.2019 22:47, John Harmon wrote: > > When using the following (first time using expect) I have many responses > > with the same prompt. I took care of the first 20 of them as you can > se

[ansible-project] Re: expect with duplicated responses

2019-03-01 Thread John Harmon
turns out I can't use this anyway due to the version of pexpect (booh!), but I would still like to know the answer for future use. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from

[ansible-project] expect with duplicated responses

2019-03-01 Thread John Harmon
When using the following (first time using expect) I have many responses with the same prompt. I took care of the first 20 of them as you can see below, however, the same prompt comes up again later during the install. I get complaints about duplicate values and the installer fails. How can I

Re: [ansible-project] lineinfile creating line when regexp not found

2019-02-27 Thread John Harmon
On Wednesday, February 27, 2019 at 8:22:43 AM UTC-7, Kai Stian Olstad wrote: > > On 26.02.2019 22:57, John Harmon wrote: > > Consider the following: > > - name: Change sshd_config settings > >lineinfile: > > path: /etc/ssh/sshd_config &g

Re: [ansible-project] lineinfile creating line when regexp not found

2019-02-27 Thread John Harmon
On Wednesday, February 27, 2019 at 8:22:43 AM UTC-7, Kai Stian Olstad wrote: > > On 26.02.2019 22:57, John Harmon wrote: > > Consider the following: > > - name: Change sshd_config settings > >lineinfile: > > path: /etc/ssh/sshd_config &g

[ansible-project] lineinfile creating line when regexp not found

2019-02-26 Thread John Harmon
Consider the following: - name: Change sshd_config settings lineinfile: path: /etc/ssh/sshd_config regexp: "{{ item.regexp }}" line: "{{ item.line }}" with_items: - {regexp: "^#.*ClientAliveInterval.*$", line: "ClientAliveInterval 1800"} - {regexp: "^#.*ClientAliveCountMax.

[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
On Tuesday, January 29, 2019 at 3:51:07 PM UTC-7, John Harmon wrote: > > Still trying to figure out how to keep the set_fact from failing when > passing in a non-existent user. If you have ideas for that, please let me > know. > ignore_errors: yes works with set_fact -

[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
Still trying to figure out how to keep the set_fact from failing when passing in a non-existent user. If you have ideas for that, please let me know. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

[ansible-project] Re: Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
Figured it out. I just call the variable with nothing else: - name: "Find the user_id for {{ user }}" set_fact: uid: "{{ (userinfo.json.users|selectattr('username','match',MYVAR)|list|first).user_id }}" -- You received this message because you are subscribed to the Google G

[ansible-project] Calling a variable within a variable within a jinja pipe filter

2019-01-29 Thread John Harmon
I am trying to do two things: 1. Call a variable while trying to set_fact within a jinja pipe filter 2. Prevent fails when the user isn't found - name: "Find the user_id for {{ user }}" set_fact: uid: "{{ (userinfo.json.users|selectattr('username','match','MYVAR')|list|first)

Re: [ansible-project] Iterating through stdout_lines (jinja formatted data) and returning data

2019-01-29 Thread John Harmon
Thank you... much easier than what I was doing. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this

[ansible-project] Iterating through stdout_lines (jinja formatted data) and returning data

2019-01-29 Thread John Harmon
I wish to automate user removal from nagios. This can be done via their REST api; however, I first need to find the user, grab their user_id, and then I can perform the delete based on the user_id. Their API returns the info in jinja format. I don't know how to iterate through the output, fin

Re: [ansible-project] set_fact with default value of type string

2019-01-28 Thread John Harmon
On Monday, January 28, 2019 at 3:02:15 PM UTC-7, Kai Stian Olstad wrote: > > On 28.01.2019 22:41, John Harmon wrote: > > I know I can define the variable previous to this, but I am wondering > > if I > > can combine setting a variable with a default value wi

[ansible-project] set_fact with default value of type string

2019-01-28 Thread John Harmon
I know I can define the variable previous to this, but I am wondering if I can combine setting a variable with a default value within set_fact. If possible, I wonder if my syntax is wrong (likely)? I can't seem to find much documentation on this. If you have a link to this answer in the docs,

[ansible-project] Ansible vault -- "ERROR! playbooks must be a list of plays"

2019-01-17 Thread John Harmon
I wouldn't be surprised if I am using this incorrectly, but I could use some outside input. Consider the following tree (not in a role): . ├── get_user_info.yml └── vault.yml vault.yml contents: --- ansible_user: someguy ansible_password: SecretPassword get_user_info.yml contents: --- - hosts:

[ansible-project] Re: Exclude match from with_items

2019-01-16 Thread John Harmon
> > > I re-read you response Brian I should be able to append to my when > statement with an and statement or something similar. I will have to go > and test it out. > Wow, I totally missed that. That should do exactly what I want to. Thank you! -- You received this message because

[ansible-project] Re: Exclude match from with_items

2019-01-16 Thread John Harmon
On Wednesday, January 16, 2019 at 4:14:36 PM UTC-7, John Harmon wrote: > > I should clarify a little. I want to remove all groups except "Domain > Users" from the user specified. I am also already using a when statement: > tasks: > - name: &quo

[ansible-project] Re: Exclude match from with_items

2019-01-16 Thread John Harmon
I should clarify a little. I want to remove all groups except "Domain Users" from the user specified. I am also already using a when statement: tasks: - name: "Disable non-vip user {{ user }}" win_domain_user: name: "{{ user }}" password: $1$SomeSalt$tNt/ObWy40s.iTT/t

[ansible-project] Exclude match from with_items

2019-01-16 Thread John Harmon
How might I go about excluding one item found under with_items? For example, assume the following: ok: [mytestserver] => { "aduser": { "account_locked": false, "attempts": 1, "changed": false, "city": "Spanish Fork", "company": "My Test Company",

[ansible-project] Re: win_domain_user and tree traversing

2019-01-09 Thread John Harmon
OK, it was an issue with credssp, but RHEL seems to have issues installing all of the necessary packages when on the latest code. I am on 7.6 with pip 18.1. I had to downgrade pip in order to install credssp: pip install --upgrade --force-reinstall pip==9.0.3 After that I upgraded pip again to

[ansible-project] Re: win_domain_user and tree traversing

2019-01-09 Thread John Harmon
H this might be a credssp issue. Let me work on that for a while and get back to this. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proj

[ansible-project] Re: win_domain_user and tree traversing

2019-01-09 Thread John Harmon
My query: tasks: - name: Windows AD Testing win_domain_user: name: "{{ user }}" state: query register: username - debug: var: username -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscr

[ansible-project] win_domain_user and tree traversing

2019-01-09 Thread John Harmon
I have two AD trees. One is a flat, test system--no frills. Users reside in the default windows container (CN=Users under the DC). The other is our production system, which has users all over the place. I am able to query the test system for users, but not the production system. Does win_do

Re: [ansible-project] Filtering variables

2019-01-08 Thread John Harmon
Perfect, thx Kai. One follow-up question. Why getent_passwd[item] instead of getentpasswd.[item] (notice the dot)? On Tuesday, January 8, 2019 at 9:25:53 AM UTC-7, Kai Stian Olstad wrote: > > On Tuesday, 8 January 2019 17:18:29 CET John Harmon wrote: > > I am using getent to sea

[ansible-project] Filtering variables

2019-01-08 Thread John Harmon
I am using getent to search for user details; however, I only wish for information regarding 3 users. I can't seem to find a way to get a filter to work. - debug: var: getent_passwd.('user1'|'user2'|'user3') I am doing something wrong, but could use a nudge in the right direction.

Re: [ansible-project] synchronize between two remote servers

2019-01-07 Thread John Harmon
I have it working. Kai was right, I couldn't use rsync:\\. When specifying a delegation all I have to do is specify the correct destination: working: - name: "Retrieve backups from mybackup02" synchronize: src: /dbbackup/nonprod_images/ dest: "{{ one_week }}/" #<--- De

Re: [ansible-project] synchronize between two remote servers

2019-01-04 Thread John Harmon
On Friday, January 4, 2019 at 11:34:13 AM UTC-7, Kai Stian Olstad wrote: > > On Friday, 4 January 2019 19:04:38 CET John Harmon wrote: > > I have found other docs on this, but can't seem to "fix" my issue with > what > > I am finding. Consider the f

[ansible-project] synchronize between two remote servers

2019-01-04 Thread John Harmon
I have found other docs on this, but can't seem to "fix" my issue with what I am finding. Consider the following playbook: - hosts: mybackup gather_facts: false vars: one_week: "/devbackup/nonprod_images/one_week_old" two_week: "/devbackup/nonprod_images/two_week_old" tasks: ..

[ansible-project] Re: General best practices regarding roles

2019-01-02 Thread John Harmon
I ended up renaming roles to role, then symlinking roles to role. It now imports them fine and I don't have to change my current way of doing things. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop re

[ansible-project] General best practices regarding roles

2019-01-02 Thread John Harmon
When setting up roles I have the following: /etc/ansible/roles # tree aliases/ -L 1 aliases/ ├── defaults ├── handlers ├── main.yml ├── meta ├── README.md ├── tasks ├── tests └── vars The main.yml has the following content: --- - hosts: "{{ host }}" gather_facts: no roles: - aliases This

Re: [ansible-project] Find all instances, and build a list

2018-12-04 Thread John Harmon
> I was researchnig a similar issue today, and couldn't came up with other > solution than: > - shell: "grep -Eo '\\w+.img' {{ file }}" > register: out > - debug: var=out.stdout_lines > > Piotr > > > > > wt., 4 gru 2018 o 18:21 John H

Re: [ansible-project] Find all instances, and build a list

2018-12-04 Thread John Harmon
On Tuesday, December 4, 2018 at 10:32:41 AM UTC-7, Kai Stian Olstad wrote: > > On Tuesday, 4 December 2018 18:21:23 CET John Harmon wrote: > > Perhaps I am doing this wrong, but it doesn't like my syntax. If I > escape > > the backslash ('\\w+.img') it tri

Re: [ansible-project] Find all instances, and build a list

2018-12-04 Thread John Harmon
Perhaps I am doing this wrong, but it doesn't like my syntax. If I escape the backslash ('\\w+.img') it tries to run but with a different error: - name: Find virtual Disks set_fact: virt_disks: "{{ lookup('file','/var/ftp/vm.cfg') | regex_findall('\w+.img') }}" Result: ERROR!

Re: [ansible-project] Find all instances, and build a list

2018-12-03 Thread John Harmon
e.com/ansible/2.5/user_guide/playbooks_filters.html#regular-expression-filters > eg: "{{ lookup('file', '/path/to/file') | regex_findall('(\w+.img)') }}" > > Piotr > > > > wt., 4 gru 2018 o 00:33 John Harmon > > napisał(a): &

[ansible-project] Re: Find all instances, and build a list

2018-12-03 Thread John Harmon
I am trying the following, but it isn't quite working like I hoped: - name: Gather current virtual disks lineinfile: path: "{{ file }}" regexp: (\w+.img) line: '' check_mode: yes register: virt_disk Result (debug of virt_disk): ok: [myftpserver] => {

[ansible-project] Find all instances, and build a list

2018-12-03 Thread John Harmon
I have a file, as an example, with the following content: disk = [file:/OVS/Repositories/0004fb03df2ee11376f1cd94/VirtualDisks /b7558d7745c14b02806d08f8003906e1.img,xvda,w,phy:/OVS/Repositories/ 0004fb03df2ee11376f1cd94/VirtualDisks/ 0004fb12049ec392e534e039,xvdb,w,file:/OVS

[ansible-project] Re: Ansible Play Output

2018-11-27 Thread John Harmon
On Tuesday, November 27, 2018 at 12:49:53 PM UTC-7, evangelin...@gmail.com wrote: > > How can I completely omit the output of an entire play? There is some info here. https://github.com/ansible/ansible/issues/1210 In short "> /dev/null", however, you can get more info by reading that doc. Ho

[ansible-project] Re: how to prompt user for hostname to deploy playbook to?

2018-11-27 Thread John Harmon
I believe your problem is that you are specifying hosts twice. The following works for me (gather facts is enabled for this example (to check ansible_fqdn), but wouldn't be necessary for this to work): --- - hosts: "{{ var_hostname }}" gather_facts: yes vars_prompt: - name: var_hostname

[ansible-project] Re: how to prompt user for hostname to deploy playbook to?

2018-11-27 Thread John Harmon
I don't know if this will help, but I never prompt for a host, and never define one in my playbooks with anything other than a variable: ie. --- # Sample playbook structure - hosts: "{{ host }}" # gather_facts: false # vars: #interval: 10 tasks: - name: Sample Name copy:

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-13 Thread John Harmon
In case anybody else is looking to do the same thing, here is my BASH solution: - name: Sanitize Virtual Interface(s) shell: | file="/var/ftp/vm.cfg" total=$( grep ^vif "$file" | grep -o mac | wc -l ) for i in `seq 1 $total`; do my_random=$(xxd -l 1 -p

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-12 Thread John Harmon
On Saturday, November 10, 2018 at 9:48:17 AM UTC-7, Thad Guidry wrote: > > John, > > What problem are you actually trying to solve ? Generating random numbers > especially around MAC certainly can get you in trouble. Are you trying to > generate a Pool and apply something 1 time from that Pool

Re: [ansible-project] Apply action for each regexp match found on same line

2018-11-12 Thread John Harmon
On Saturday, November 10, 2018 at 2:07:52 AM UTC-7, Kai Stian Olstad wrote: > > On Wednesday, 7 November 2018 17:36:43 CET John Harmon wrote: > > Desired (As shown above, keep first three octets of mac, change 4th to > AA, > > and the last two are random numbers bet

[ansible-project] Re: Apply action for each regexp match found on same line

2018-11-08 Thread John Harmon
On Thursday, November 8, 2018 at 10:22:00 AM UTC-7, EspressoBeanies wrote: > > John, you can do all instances via the replace command or the last > instance from the lineinfile command. > > On Thursday, November 8, 2018 at 11:14:20 AM UTC-5, John Harmon wrote: >> >&g

[ansible-project] Re: Apply action for each regexp match found on same line

2018-11-08 Thread John Harmon
bump -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@google

[ansible-project] Apply action for each regexp match found on same line

2018-11-07 Thread John Harmon
Assume the following line: vif = ['mac=00:21:f6:04:16:f3,bridge=101498d8ff', 'mac=00:21:f6:80:0b:d9,bridge=1017dc5841'] If I use lineinfile, replace, etc to do a regular expression match, can I somehow apply the following to each instances (instead of just once for both instances): Action: rege

Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon
> If you that is the only place you have phy: replace module would be a lot > easier. > > - replace: > path: /path/to/file > regexp: (, )?'phy:[^']+' > replace: '' > > > -- > Kai Stian Olstad > > > Yep, you are right. That is much easier. I'll go that route. Out of

Re: [ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon
> So you have a regexp that isn't working, but haven't told us what you are > trying to do, so it's actually impossible to help you. > > > -- > Kai Stian Olstad > > > In the link I provided there is a sample string. I capture 6 different groups. In short, I am trying to remove all phy devi

[ansible-project] Regexp failure: Unmatched group

2018-11-05 Thread John Harmon
I am getting a failure with the latter half of my task. I replaced the working stuff with According to a regexp tester, every group does have something, and I don't have empty groups. https://regex101.com/r/MNkwaD/1 I changed stdout_callback to minimal, but it didn't look much different. I

Re: [ansible-project] Manipulating part of a custom variable

2018-11-05 Thread John Harmon
Ah, it was the single quotes that I was missing. Thank you. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To

Re: [ansible-project] Manipulating part of a custom variable

2018-11-05 Thread John Harmon
How can I throw in a custom string? Everything I try seems to fail: Working: newname: "{{ oldname.stdout ~ ansible_date_time.date }}" Returns: myserver2018-11-05 Desired: myserver-COPY-2018-11-05 -- You received this message because you are subscribed to the Google Groups "Ansible Project" gr

Re: [ansible-project] Why doesn't Ansible like my regexp?

2018-11-05 Thread John Harmon
Thanks Kai! That was the issue. No complaints from Ansible now. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com

[ansible-project] Why doesn't Ansible like my regexp?

2018-11-05 Thread John Harmon
As far as I can tell I have all of my quotes... it just doesn't seem to like my escaping... Adding verbosity didn't give me any useful information. - name: Sanitize vm.cfg step 2 of lineinfile: path: "{{ file }}" regexp: "{{ item.regexp }}" line: "{{ item.line

Re: [ansible-project] Manipulating part of a custom variable

2018-11-02 Thread John Harmon
Thank you -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@g

Re: [ansible-project] Manipulating part of a custom variable

2018-11-02 Thread John Harmon
Awesome, that works! Using a large number for randomizing didn't even occur to me. Just one follow-up question. Can you explain to me what the tilde ~ is doing? Having a hard time finding info on it. -- You received this message because you are subscribed to the Google Groups "Ansible Proj

Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread John Harmon
On Friday, November 2, 2018 at 2:40:07 PM UTC-6, Brad Van Orden wrote: > > I knew it wasn't ansible, but just didn't have quick access to test it. > So, gave sed so that he could see a working regex. :) > > On Fri, Nov 2, 2018 at 12:52 PM John Harmon > wrote: >

[ansible-project] Manipulating part of a custom variable

2018-11-02 Thread John Harmon
I have a variable called 'oldid' set to a value of '0004fb06b824b442d236a8b7' I wish to manipulate it so that I do the following: 1. strip off the last 12 characters (slicing?) 2. Re-add 12 more characters that are a random numbers between 0-9 Here is what I have, but unsure if I can e

Re: [ansible-project] regexp help? Replace part of string

2018-11-02 Thread John Harmon
Awesome, thanks guys! Kai, I am unsure if I would have got that one my own. I can see what it is doing now, but is near voodoo to me. I thought I understood backrefs at a very basic level, but this proves I have a long way to go. Thank you. > > -- You received this message because you are

[ansible-project] regexp help? Replace part of string

2018-11-01 Thread John Harmon
I have been thinking about doing this with lineinfile with backrefs, or with the replace module, but I am at a loss as to where to start (I am horrible with regexp) Consider the following: vif = ['mac=00:21:f6:A1:B7:49,bridge=1053d3f53c'] I would like to replace the last three octets, but l

[ansible-project] Fate of Ansible & Tower -- IBM Acquiring RedHat

2018-10-30 Thread John Harmon
Maybe this isn't the place for this, but just wondering your thoughts on the acquisition of RedHat by IBM. They promise to keep it as its own business unit, but we have seen things like this in the past. I used to work for Novell when it acquired Suse. Personally, I don't trust IBM to do wha

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread John Harmon
ansible myserver -m setup -a 'gather_subset=hardware' is definitely the culprit. Do you know of any way to break down the hardware subset to further narrow this down? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread John Harmon
On Wednesday, September 26, 2018 at 5:14:40 PM UTC-6, Steve R wrote: > > Is normal ssh to the server slow or only with Ansible? > > Normal SSH to the server is quick and responsive. If I ssh from the ansible server it is even quicker than from my current location directly to the server (The ans

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-26 Thread John Harmon
Marcos, I can execute an ad-hoc, but I don't know what you mean by "all the debug"--or how to do that. If I run the following, it returns promptly: root@ansible:/etc/ansible # ansible myserver -m debug myserver | SUCCESS => { "msg": "Hello world!" } Kai, I cannot find any IO issues on the

Re: [ansible-project] Re: Ansible copy module not working recursively--or with dirs

2018-09-06 Thread John Harmon
On Thursday, September 6, 2018 at 10:54:45 AM UTC-6, Brian Coca wrote: > > fileglob only does files, not directories, you want filetree or just > pipe 'find files/*' .. or `src=files/` and avoid the loop > > -- > -- > Brian Coca > I thought I had tried that before, but I guess not.

  1   2   3   >