[ansible-project] Question regarding aws_sts_assumerole

2020-07-15 Thread Des Sindatry
Hello,

I am using ansible to launch ec2 instances . As part of that using ADFS 
SAML integration. 

 Playbook 

---
- name: Ansible test
  hosts: localhost

  tasks:
  - name:
sts_assume_role:
  role_arn: "arn:aws:sts::925052198153:assumed-role/DBAAdmin"
  role_session_name: "default"
register: assumed_role

  - ec2_instance:
  instance_type: t2.large
  key_name: comdpl_test
  image: ami-07527564b23c84506
  region: us-east-1
  group: ci360-stage-us-east-1-cloudera-main-sg
  count: 1
  vpc_subnet_id: vpc-cf5347b7
  wait: yes
  assign_public_ip: yes
  aws_access_key: "{{ assumed_role.sts_creds.access_key }}"
  aws_secret_key: "{{ assumed_role.sts_creds.secret_key }}"
  security_token: "{{ assumed_role.sts_creds.session_token }}"
  volumes:
- device_name: /dev/sdb
  volume_type: gp2
  volume_size: 10
  delete_on_termination: true


#
I get this error. Can someone please guide me 

ClientError: An error occurred (AccessDenied) when calling the AssumeRole 
operation: User: arn:aws:sts::925052198153:assumed-role/DBAAdmin/
desmond.sinda...@sas.com is not authorized to perform: sts:AssumeRole on 
resource: arn:aws:sts::925052198153:assumed-role/DBAAdmin

[desind@adffddfd~]$ aws sts get-caller-identity
{
"UserId": "AROAIZEC7DF4ASDSRA2SS:desmond.sinda...@sas.com",
"Account": "925052198153",
"Arn": "arn:aws:sts::925052198153:assumed-role/DBAAdmin/
desmond.sinda...@sas.com"
}


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bfb466c7-b532-48ac-8c87-571d01f6a79co%40googlegroups.com.


[ansible-project] New to Ansible - install Infrastructure

2020-07-15 Thread Daniel
I am new to Ansible, my company is doing a POC to move away from our 
current tool.

I have an eval license for Ansible Tower, however, I am also going to run 
dual POC's one with Tower and one with AWX.

We will have the infrastructure on AWS, can I put AWX on an Amazon Linux 
server or does it have to be Redhat or CentOS also?

Tower install only wants Redhat or CentOS.

Thank you
Daniel

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6908ce9a-a7b3-401e-b6a6-19be9084912do%40googlegroups.com.


Re: [ansible-project] Save output to text file

2020-07-15 Thread Tcpip
Hello ,

I tried with this configuration 

- name: SAVE OUTPUT TO FILE
  copy:
content: "{{ enviro.results[0].stdout }}"
dest: "/root/playbooks/results/{{ inventory_hostname }}-space.txt"
  tags: save

But still having the same issue

fatal: [localhost]: FAILED! => {
"msg": "The task includes an option with an undefined variable. The 
error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to 
be in '/root/playbooks/space_mail.yml': line 20, column 7, but may\nbe 
elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n\n- name: SAVE OUTPUT TO FILE\n  ^ 
here\n"
}

Thanks. 



On Monday, July 13, 2020 at 2:48:20 AM UTC-3 lorenze...@gmail.com wrote:

> Hello,
>
> Since you're collecting your results with a loop, you'll have several 
> results registered in enviro variable.
>
> enviro.results[0].stdout will point to the stdout of the first command, 
> and so on.
>
> Luca
>
> Il lun 13 lug 2020, 00:25 Tcpip  ha scritto:
>
>> Hello
>>
>> I have my playbook that will just execute df -h and  ls -ll  teh issue is 
>> that is not being able to save the output to a txt file 
>>
>> ---
>> - name: Devices to get output
>>   hosts: centos2
>>   connection: local 
>>
>>   tasks:
>>
>>- name: GET LINUX INFO
>>  shell:
>>cmd: "{{ item }}"
>>  with_items:
>>- df -h
>>- ls -ll
>>  register: enviro
>>
>>
>>- name: get timestamp
>>  command: date +%F.%H:%M:%S
>>  register: time
>>
>>- name: create folder
>>  file:
>>path: /root/Linux_{{ inventory_hostname }}
>>state: directory
>>
>> #   - debug: var=free_output.stdout_lines
>>
>>- name: save output
>>  copy: 
>>content: "{{ enviro.stdout[0] }}" 
>>dest: "/root/Linux_{{ inventory_hostname 
>> }}/space_{{time.stdout}}.txt"
>>
>>
>> This is the debug of the output
>>
>> fatal: [centos2]: FAILED! => {
>> "msg": "The task includes an option with an undefined variable. The 
>> error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to 
>> be in '/hidro/2hidro.yml': line 28, column 6, but may\nbe elsewhere in the 
>> file depending on the exact syntax problem.\n\nThe offending line appears 
>> to be:\n\n\n   - name: save output\n ^ here\n"
>> }
>>
>>
>> Thanks.
>>
>> -- 
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/d25b06f3-50aa-4143-958f-e96ba324ad81o%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b81d8ab0-6395-4659-bc82-b4add3ca8513n%40googlegroups.com.


Re: [ansible-project] Re: remove mysql

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 6:55 PM, Tony Wong wrote:
> this was the original install and I am just trying to reverse the installs
> 
> 

What is the distribution and the release of the target server(s)?

Regards
  Racke

> ---
> - hosts: all
>   become: true
>   vars_files:
>     - vars/default.yml
> tasks:
>     - name: Install prerequisites
>       apt: name={{ item }} update_cache=yes state=absent force_apt_get=yes
>       loop: [ 'aptitude' ]
> 
>   #Apache Configuration
>     - name: Install LAMP Packages
>       apt: name={{ item }} update_cache=yes state=absent
>       loop: [ 'apache2', 'mysql-server', 'python3-pymysql', 'php', 
> 'php-mysql', 'libapache2-mod-php' ]
> 
>     - name: Create document root
>       file:
>         path: "/var/www/{{ http_host }}"
>         state: directory
>         owner: "{{ app_user }}"
>         mode: '0755'
> 
>     - name: Set up Apache virtualhost
>       template:
>         src: "files/apache.conf.j2"
>         dest: "/etc/apache2/sites-available/{{ http_conf }}"
>       notify: Reload Apache
> 
>     - name: Enable new site
>       shell: /usr/sbin/a2ensite {{ http_conf }}
>       notify: Reload Apache
> 
>     - name: Disable default Apache site
>       shell: /usr/sbin/a2dissite 000-default.conf
>       when: disable_default
>       notify: Reload Apache
> 
>   # MySQL Configuration
>     - name: Sets the root password
>       mysql_user:
>         name: root
>  
> 
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CALmkhkoJqa11F8P6Y2SBKr94E8PhgNpAqR_GA8AW%2Bch5NH0QoQ%40mail.gmail.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ed3037a6-ee6f-7e09-af51-740cd794ae27%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[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 list | egrep 
'^mysql-server/|^mysql-client/|^python3-pymysql/|^php/|^libapache2-mod-php/'

Can you write a playbook with just the single task and run it with "-vvv" 
and paste the output in a response here?

The indenting in your previous example is slightly askew, and it is missing 
the "state: absent" parameter, but I'll make the assumption that is just a 
copy-and-paste error. 
On Wednesday, July 15, 2020 at 12:21:47 PM UTC-5 tdub...@gmail.com wrote:

> I tried this pb but its not uninstalling
>
>
> --
> - hosts: all
>   become: true
>   vars_files:
> - vars/default.yml
>
>   tasks:
> - name: remove
>
>   apt:
>name:
> - mysql-server
> - mysql-client
> - python3-pymysql
> - php
> - php-mysql
> - libapache2-mod-php
>
> On Wed, Jul 15, 2020 at 9:55 AM Tony Wong  wrote:
>
>> this was the original install and I am just trying to reverse the installs
>>>
>>
>> ---
>> - hosts: all
>>   become: true
>>   vars_files:
>> - vars/default.yml
>> tasks:
>> - name: Install prerequisites
>>   apt: name={{ item }} update_cache=yes state=absent force_apt_get=yes
>>   loop: [ 'aptitude' ]
>>
>>   #Apache Configuration
>> - name: Install LAMP Packages
>>   apt: name={{ item }} update_cache=yes state=absent
>>   loop: [ 'apache2', 'mysql-server', 'python3-pymysql', 'php', 
>> 'php-mysql', 'libapache2-mod-php' ]
>>
>> - name: Create document root
>>   file:
>> path: "/var/www/{{ http_host }}"
>> state: directory
>> owner: "{{ app_user }}"
>> mode: '0755'
>>
>> - name: Set up Apache virtualhost
>>   template:
>> src: "files/apache.conf.j2"
>> dest: "/etc/apache2/sites-available/{{ http_conf }}"
>>   notify: Reload Apache
>>
>> - name: Enable new site
>>   shell: /usr/sbin/a2ensite {{ http_conf }}
>>   notify: Reload Apache
>>
>> - name: Disable default Apache site
>>   shell: /usr/sbin/a2dissite 000-default.conf
>>   when: disable_default
>>   notify: Reload Apache
>>
>>   # MySQL Configuration
>> - name: Sets the root password
>>   mysql_user:
>> name: root
>>  
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/22025670-024c-4721-a6c5-d2103962f99dn%40googlegroups.com.


[ansible-project] Ansible Registry workaround for CVE-2020-1350

2020-07-15 Thread Gerry Maddock
If needed. This worked for me.


# DESCRIPTION

# Registry workaround for CVE-2020-1350

- name: Registry workaround for CVE-2020-1350

hosts: dns_servers

gather_facts: yes

tasks:

- name: Apply Reg workaround

win_regedit:

path: HKLM:\SYSTEM\CurrentControlSet\Services\DNS\Parameters

name: TcpReceivePacketSize

data: 0xFF00

type: dword

state: present

- name: Restart DNS

win_service:

name: DNS

state: restarted

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B1bNWsyFg_LVJ0%2BsZwOaUc84LOaRKEZvhd_qDs_7EfiQfp%2BGA%40mail.gmail.com.


Re: [ansible-project] ansible - rhel8

2020-07-15 Thread 'Chris Bidwell - NOAA Federal' via Ansible Project
Here is the whole playbook:

---
- name: Install zabbix
  hosts: ALL_LINUX
  become: yes
  vars_files:
- passwd.yml
- vars.yml
  ignore_errors: yes

  vars:
os_version: "{{ ansible_distribution_major_version }}"
zabbix_repo: /etc/yum.repos.d/zabbix.repo
zabbix_config: /etc/zabbix/zabbix_agentd.conf
zabbix_8:
https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
zabbix_7:
https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
zabbix_6:
https://repo.zabbix.com/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm
proxy_env:
  http_proxy: 'http://proxy:8080'

  tasks:
- name: cat /etc/yum.conf
  shell: cat /etc/yum.conf
  register: proxy
  tags:
- YUM

- name: check if repo files exists
  stat:
path: "{{ zabbix_repo }}"
  register: zabbix_exists
  tags:
- YUM
- CHECK

- name: "install 8 if not exists (proxy)"
  dnf:
name: "{{ zabbix_8 }}"
state: latest
disable_gpg_check: yes
  ignore_errors: true
  environment: "{{ proxy_env }}"
  when:
- ansible_distribution_major_version is version('8', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.226\.') or
  ansible_default_ipv4.address is match('10\.172\.226\.')
  tags:
- PROXY
- YUM

- name: "install 8 if not exists (noproxy)"
  dnf:
name: "{{ zabbix_8 }}"
state: latest
disable_gpg_check: yes
  ignore_errors: true
  when:
- ansible_distribution_major_version is version('8', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.224\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.') or
  ansible_default_ipv4.address is match('192\.168\.225\.') or
  ansible_default_ipv4.address is match('192\.168\.227\.') or
  ansible_default_ipv4.address is match('192\.168\.228\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.')
  tags:
- PROXY
- YUM

- name: "install 7 if not exists (proxy)"
  yum:
name: "{{ zabbix_7 }}"
state: latest
disable_gpg_check: yes
  ignore_errors: true
  environment: "{{ proxy_env }}"
  when:
- ansible_distribution_major_version is version('7', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.226\.') or
  ansible_default_ipv4.address is match('10\.172\.226\.')
  tags:
- PROXY
- YUM

- name: "install 7 if not exists (noproxy)"
  yum:
name: "{{ zabbix_7 }}"
state: latest
disable_gpg_check: yes
  ignore_errors: true
  when:
- ansible_distribution_major_version is version('7', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.224\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.') or
  ansible_default_ipv4.address is match('192\.168\.225\.') or
  ansible_default_ipv4.address is match('192\.168\.227\.') or
  ansible_default_ipv4.address is match('192\.168\.228\.') or
  ansible_default_ipv4.address is match('192\.168\.224\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.')
  tags:
- PROXY
- YUM

- name: "install 6 if not exists (proxy)"
  yum:
name: "{{ zabbix_6 }}"
state: latest
  ignore_errors: true
  environment: "{{ proxy_env }}"
  when:
- ansible_distribution_major_version is version('6', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.226\.') or
  ansible_default_ipv4.address is match('10\.172\.226\.')
  tags:
- YUM

- name: "install 6 if not exists (no proxy)"
  yum:
name: "{{ zabbix_6 }}"
state: latest
  ignore_errors: true
  when:
- ansible_distribution_major_version is version('6', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.224\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.') or
  ansible_default_ipv4.address is match('192\.168\.225\.') or
  ansible_default_ipv4.address is match('192\.168\.227\.') or
  ansible_default_ipv4.address is match('192\.168\.228\.') or
  ansible_default_ipv4.address is match('192\.168\.224\.') or
  ansible_default_ipv4.address is match('192\.168\.223\.')
  tags:
- YUM

- name: add proxy to zabbix.repo if needed
  lineinfile:
path: /etc/yum.repos.d/zabbix.repo
regexp: 'proxy'
state: present
line: 'proxy=http://proxy:8080'
insertafter: '\[zabbix\]'
 

[ansible-project] Re: Integrating Microsoft LAPS and ansible

2020-07-15 Thread Jordan Borean
I don’t understand what you mean sorry. OpenLDAP is required on the controller 
because that’s a dependency of python-ldap that the lookup uses 
https://www.python-ldap.org/en/python-ldap-3.3.0/installing.html#installing. If 
you already have it installed then you don’t need to reinstall it.

If some hosts use LAPS then you can use this for plugin to get the password, 
for the others that don’t then you need some other mechanism to get the 
password.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c09a35bb-14a6-4fff-9965-d2f7d3396398o%40googlegroups.com.


Re: [ansible-project] ansible - rhel8

2020-07-15 Thread vinoth kumar
Where is your actual tasks starts ?

Tasks is missing

On Wed 15. Jul 2020 at 20:17, 'Chris Bidwell - NOAA Federal' via Ansible
Project  wrote:

> Hey all,
>
> having an interesting issue with my latest rhel8 installation.
>
> Trying to install an rpm from a URL.  Here's my playbook:
>
> ---
> - name: Install zabbix
>   hosts: ALL_LINUX
>   become: yes
>   vars_files:
> - passwd.yml
> - vars.yml
>   ignore_errors: yes
>
>   vars:
> os_version: "{{ ansible_distribution_major_version }}"
> zabbix_repo: /etc/yum.repos.d/zabbix.repo
> zabbix_config: /etc/zabbix/zabbix_agentd.conf
>
> *zabbix_8:
> https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
> *
>   zabbix_7:
> https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
> zabbix_6:
> https://repo.zabbix.com/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm
> proxy_env:
>   http_proxy: 'http://proxy:8080'
>
> - name: check if repo files exists
>   stat:
> path: "{{ zabbix_repo }}"
>   register: zabbix_exists
>   tags:
> - YUM
> - CHECK
>
> - name: "install 8 if not exists (proxy)"
>   dnf:
> name: "{{ zabbix_8 }}"
> state: latest
> disable_gpg_check: yes
>   ignore_errors: true
>   environment: "{{ proxy_env }}"
>   when:
> - ansible_distribution_major_version is version('8', '=')
> - zabbix_exists.stat.exists == False
> - ansible_default_ipv4.address is match('192\.168\.226\.') or
>   ansible_default_ipv4.address is match('10\.172\.226\.')
>   tags:
> - PROXY
> - YUM
>
>
> Here is my error output:
> TASK [install 8 if not exists (proxy)]
> ***
> fatal: [corona-lx]: FAILED! => {"changed": false, "msg": "Failure
> downloading
> https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm,
> Request failed:  protocol>", "results": []}
>
> Thought it may be dns-related but I'm able to resolve the name fine.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAHKi8Ci7hMJzUDYuDM1AVpnpYf9xH%2BjogANN6EzMOvWNF8AMrA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ%2BRxtQjbUTX%3DmEf6qh%2BR%2BSdh%3DKMRiC7TpbhJm3y9SaaRGQ%2B1w%40mail.gmail.com.


[ansible-project] ansible - rhel8

2020-07-15 Thread 'Chris Bidwell - NOAA Federal' via Ansible Project
Hey all,

having an interesting issue with my latest rhel8 installation.

Trying to install an rpm from a URL.  Here's my playbook:

---
- name: Install zabbix
  hosts: ALL_LINUX
  become: yes
  vars_files:
- passwd.yml
- vars.yml
  ignore_errors: yes

  vars:
os_version: "{{ ansible_distribution_major_version }}"
zabbix_repo: /etc/yum.repos.d/zabbix.repo
zabbix_config: /etc/zabbix/zabbix_agentd.conf

*zabbix_8:
https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
*
  zabbix_7:
https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
zabbix_6:
https://repo.zabbix.com/zabbix/4.4/rhel/6/x86_64/zabbix-release-4.4-1.el6.noarch.rpm
proxy_env:
  http_proxy: 'http://proxy:8080'

- name: check if repo files exists
  stat:
path: "{{ zabbix_repo }}"
  register: zabbix_exists
  tags:
- YUM
- CHECK

- name: "install 8 if not exists (proxy)"
  dnf:
name: "{{ zabbix_8 }}"
state: latest
disable_gpg_check: yes
  ignore_errors: true
  environment: "{{ proxy_env }}"
  when:
- ansible_distribution_major_version is version('8', '=')
- zabbix_exists.stat.exists == False
- ansible_default_ipv4.address is match('192\.168\.226\.') or
  ansible_default_ipv4.address is match('10\.172\.226\.')
  tags:
- PROXY
- YUM


Here is my error output:
TASK [install 8 if not exists (proxy)]
***
fatal: [corona-lx]: FAILED! => {"changed": false, "msg": "Failure
downloading
https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm,
Request failed: ", "results": []}

Thought it may be dns-related but I'm able to resolve the name fine.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAHKi8Ci7hMJzUDYuDM1AVpnpYf9xH%2BjogANN6EzMOvWNF8AMrA%40mail.gmail.com.


[ansible-project] Re: remove mysql

2020-07-15 Thread Tony Wong
I tried this pb but its not uninstalling


--
- hosts: all
  become: true
  vars_files:
- vars/default.yml

  tasks:
- name: remove
  apt:
   name:
- mysql-server
- mysql-client
- python3-pymysql
- php
- php-mysql
- libapache2-mod-php

On Wed, Jul 15, 2020 at 9:55 AM Tony Wong  wrote:

> this was the original install and I am just trying to reverse the installs
>>
>
> ---
> - hosts: all
>   become: true
>   vars_files:
> - vars/default.yml
> tasks:
> - name: Install prerequisites
>   apt: name={{ item }} update_cache=yes state=absent force_apt_get=yes
>   loop: [ 'aptitude' ]
>
>   #Apache Configuration
> - name: Install LAMP Packages
>   apt: name={{ item }} update_cache=yes state=absent
>   loop: [ 'apache2', 'mysql-server', 'python3-pymysql', 'php',
> 'php-mysql', 'libapache2-mod-php' ]
>
> - name: Create document root
>   file:
> path: "/var/www/{{ http_host }}"
> state: directory
> owner: "{{ app_user }}"
> mode: '0755'
>
> - name: Set up Apache virtualhost
>   template:
> src: "files/apache.conf.j2"
> dest: "/etc/apache2/sites-available/{{ http_conf }}"
>   notify: Reload Apache
>
> - name: Enable new site
>   shell: /usr/sbin/a2ensite {{ http_conf }}
>   notify: Reload Apache
>
> - name: Disable default Apache site
>   shell: /usr/sbin/a2dissite 000-default.conf
>   when: disable_default
>   notify: Reload Apache
>
>   # MySQL Configuration
> - name: Sets the root password
>   mysql_user:
> name: root
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhko7-orxfCx75Fwjgqk68kpQaqofNb0TqwAQOn3KfiXXDQ%40mail.gmail.com.


[ansible-project] Re: remove mysql

2020-07-15 Thread Tony Wong
>
> this was the original install and I am just trying to reverse the installs
>

---
- hosts: all
  become: true
  vars_files:
- vars/default.yml
tasks:
- name: Install prerequisites
  apt: name={{ item }} update_cache=yes state=absent force_apt_get=yes
  loop: [ 'aptitude' ]

  #Apache Configuration
- name: Install LAMP Packages
  apt: name={{ item }} update_cache=yes state=absent
  loop: [ 'apache2', 'mysql-server', 'python3-pymysql', 'php',
'php-mysql', 'libapache2-mod-php' ]

- name: Create document root
  file:
path: "/var/www/{{ http_host }}"
state: directory
owner: "{{ app_user }}"
mode: '0755'

- name: Set up Apache virtualhost
  template:
src: "files/apache.conf.j2"
dest: "/etc/apache2/sites-available/{{ http_conf }}"
  notify: Reload Apache

- name: Enable new site
  shell: /usr/sbin/a2ensite {{ http_conf }}
  notify: Reload Apache

- name: Disable default Apache site
  shell: /usr/sbin/a2dissite 000-default.conf
  when: disable_default
  notify: Reload Apache

  # MySQL Configuration
- name: Sets the root password
  mysql_user:
name: root

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkoJqa11F8P6Y2SBKr94E8PhgNpAqR_GA8AW%2Bch5NH0QoQ%40mail.gmail.com.


Re: [ansible-project] remove mysql

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 5:38 PM, Tony Wong wrote:
> trying to remove mysql from a previous install
> 
> --
> - hosts: all
>   become: true
>   vars_files:
>     - vars/default.yml
> 
>   tasks:
>   - name: Uninstall MySQL packages.
>     apt: name={{ item }} state=absent
>     with_items:
>       - mysql-server
>       - mysql-client
> 
> but not working 

To me it looks like it works (removing the packages), but your syntax is 
outdated.

It should be

   apt:
 name:
   - mysql-server
   - mysql-client


Regards
 Racke

> 
> 
> [Uninstall MySQL packages.]
> 
> [DEPRECATION WARNING]: Invoking "apt" only once while using a loop via 
> squash_actions is deprecated. Instead of using a
> loop to supply multiple
> items and specifying `name: "{{ item }}"`, please use `name: ['mysql-server', 
> 'mysql-client']` and remove the loop. This
> feature will be removed
>  in version 2.11. Deprecation warnings can be disabled by setting 
> deprecation_warnings=False in ansible.cfg.
> ok: [ubuntu2] => (item=[u'mysql-server', u'mysql-client'])
> 
> 
> 
> 
> 
> 
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CALmkhkrCLRKxcYdgxW4C%2BjgvDgRu8_F%2BC-C8kNVdsV37HbGHqg%40mail.gmail.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f83ecd7b-e573-985a-329b-6a4d59bb5b1a%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] How to retrieve arguments to ansible-playbook from ansible?

2020-07-15 Thread Dick Visser
Yes, that goes a long way.
But I realized we call ansible-playbook from a shell wrapper, so I
used "${@}" in there instead.

thx!

On Wed, 15 Jul 2020 at 17:28, Nuno Jordão  wrote:
>
> Hello,
>
> Is this what you are looking for?
>
> https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html
>
> Nuno Jordão
>
> On Wed, Jul 15, 2020 at 3:04 PM Dick Visser  wrote:
>>
>> Hi
>>
>> As part of our deployment we are saving a file
>> /etc/deployment_status.json onto remote nodes:
>>
>>   vars:
>> deployment_status:
>>   version: "{{ our_version }}"
>>   date: "{{ ansible_date_time.iso8601 }}"
>>   deployer: "{{ lookup('env', 'USER') }}"
>>   ansible: "{{ lookup('pipe', 'ansible --version') }}"
>>
>>   pre_tasks:
>> - name: Write deployment status to /etc/deployment_status.json
>>   copy:
>> content: "{{ deployment_status | to_nice_json }}"
>> dest: /etc/deployment_status.json
>>   tags: always,deployment_status
>>
>>
>> This has proven to be helpful.
>> Now I would like to also include information about how
>> ansible-playbook was invoked, for instance which tags were used, or
>> what hosts the deployment was limited to.
>> Is there any way of knowing what arguments ansible-playbook was run
>> with, from within ansible?
>>
>>
>> thx!
>>
>> --
>> Dick Visser
>> Trust & Identity Service Operations Manager
>> GÉANT
>>
>> --
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNMgorhYQNUqub1FqPjo9H_XQCzzLB5pvkOCK%2Bx5SMgbw%40mail.gmail.com.
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAEAA%3Dtut09AGcXU_95dnaTG0ouYdTsu9WR7N%2BAAgmLqLbs5-zw%40mail.gmail.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwO2daUwcpL7O74kLwpOPF9UA5gaRcO%2BZdiNej1-n%2BU3GQ%40mail.gmail.com.


[ansible-project] Re: how to determine group's id?

2020-07-15 Thread Laci
Thank you, this did it:

  - name: set fact for group
set_fact:
  group_id: "{{ getent_group.monitor[1] }}"
  
  - name: Add proc to fstab and mount it
mount:
path: /proc
src: proc
fstype: proc
opts: "defaults,hidepid=2,gid={{ group_id }}"
dump: 0
passno: 0
backup: true
state: mounted

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cebb1b7f-0c01-41b6-a419-f72ab83832deo%40googlegroups.com.


[ansible-project] remove mysql

2020-07-15 Thread Tony Wong
trying to remove mysql from a previous install

--
- hosts: all
  become: true
  vars_files:
- vars/default.yml

  tasks:
  - name: Uninstall MySQL packages.
apt: name={{ item }} state=absent
with_items:
  - mysql-server
  - mysql-client

but not working


[Uninstall MySQL packages.]

[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via
squash_actions is deprecated. Instead of using a loop to supply multiple
items and specifying `name: "{{ item }}"`, please use `name:
['mysql-server', 'mysql-client']` and remove the loop. This feature will be
removed
 in version 2.11. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
ok: [ubuntu2] => (item=[u'mysql-server', u'mysql-client'])

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkrCLRKxcYdgxW4C%2BjgvDgRu8_F%2BC-C8kNVdsV37HbGHqg%40mail.gmail.com.


Re: [ansible-project] How to retrieve arguments to ansible-playbook from ansible?

2020-07-15 Thread Nuno Jordão
Hello,

Is this what you are looking for?

https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html


Nuno Jordão

On Wed, Jul 15, 2020 at 3:04 PM Dick Visser  wrote:

> Hi
>
> As part of our deployment we are saving a file
> /etc/deployment_status.json onto remote nodes:
>
>   vars:
> deployment_status:
>   version: "{{ our_version }}"
>   date: "{{ ansible_date_time.iso8601 }}"
>   deployer: "{{ lookup('env', 'USER') }}"
>   ansible: "{{ lookup('pipe', 'ansible --version') }}"
>
>   pre_tasks:
> - name: Write deployment status to /etc/deployment_status.json
>   copy:
> content: "{{ deployment_status | to_nice_json }}"
> dest: /etc/deployment_status.json
>   tags: always,deployment_status
>
>
> This has proven to be helpful.
> Now I would like to also include information about how
> ansible-playbook was invoked, for instance which tags were used, or
> what hosts the deployment was limited to.
> Is there any way of knowing what arguments ansible-playbook was run
> with, from within ansible?
>
>
> thx!
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwNMgorhYQNUqub1FqPjo9H_XQCzzLB5pvkOCK%2Bx5SMgbw%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEAA%3Dtut09AGcXU_95dnaTG0ouYdTsu9WR7N%2BAAgmLqLbs5-zw%40mail.gmail.com.


Re: [ansible-project] how to determine group's id?

2020-07-15 Thread Vladimir Botka
On Wed, 15 Jul 2020 06:34:10 -0700 (PDT)
Laci  wrote:

>  - getent:
>   database: group
>   - debug:
>   var: getent_group.monitor
> 
>   - name: add line to fstab
> lineinfile:
>   path: /etc/fstab
>   line: proc/procprocdefaults,hidepid=2,gid={{ var }}
>  0 0

Set the variable first. "gid" is the second item in the list. For example

- getent:
database: group
- set_fact:
my_gid: "{{ getent_group.monitor.1 }}"

See if this is what you want

- debug:
var: my_gid

Then use this variable to mount procfs. For example

- mount:
path: proc
src: /proc
fstype: proc
opts: "defaults,hidepid=2,gid={{ my_gid }}"
dump: 0
passno: 0
backup: true
state: mounted

(not tested)

It's a good idea to "backup: true" /etc/fstab. Take a look at the parameter
"state" and decide when you want to mount procfs.

Check the playbook first and see what's going to be changed

shell> ansible-playbook pb.yml -CD

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200715165658.3623f94e%40gmail.com.


pgpVZp85r4CAX.pgp
Description: OpenPGP digital signature


Re: [ansible-project] how to determine group's id?

2020-07-15 Thread Vladimir Botka
On Wed, 15 Jul 2020 06:34:10 -0700 (PDT)
Laci  wrote:

>   - name: add line to fstab
> lineinfile:
>   path: /etc/fstab
>   line: proc/procprocdefaults,hidepid=2,gid={{ var }}

Use "mount". It will create the entry in fstab
https://docs.ansible.com/ansible/latest/modules/mount_module.html

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200715162806.201991d8%40gmail.com.


pgpS15oyx9p7v.pgp
Description: OpenPGP digital signature


[ansible-project] How to retrieve arguments to ansible-playbook from ansible?

2020-07-15 Thread Dick Visser
Hi

As part of our deployment we are saving a file
/etc/deployment_status.json onto remote nodes:

  vars:
deployment_status:
  version: "{{ our_version }}"
  date: "{{ ansible_date_time.iso8601 }}"
  deployer: "{{ lookup('env', 'USER') }}"
  ansible: "{{ lookup('pipe', 'ansible --version') }}"

  pre_tasks:
- name: Write deployment status to /etc/deployment_status.json
  copy:
content: "{{ deployment_status | to_nice_json }}"
dest: /etc/deployment_status.json
  tags: always,deployment_status


This has proven to be helpful.
Now I would like to also include information about how
ansible-playbook was invoked, for instance which tags were used, or
what hosts the deployment was limited to.
Is there any way of knowing what arguments ansible-playbook was run
with, from within ansible?


thx!

-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNMgorhYQNUqub1FqPjo9H_XQCzzLB5pvkOCK%2Bx5SMgbw%40mail.gmail.com.


Re: [ansible-project] how to determine group's id?

2020-07-15 Thread Laci
Thank you guys, this fixes the first part.
But how do I reuse the output of getent, I tried, the following but didn't 
work

 - getent:
  database: group
  - debug:
  var: getent_group.monitor

  - name: add line to fstab
lineinfile:
  path: /etc/fstab
  line: proc/procprocdefaults,hidepid=2,gid={{ var }}
 0 0

"The task includes an option with an undefined variable. The error was: 
'var' is undefined

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bc51a905-f54b-44da-8a70-6c5645dcbc71o%40googlegroups.com.


[ansible-project] Re: Integrating Microsoft LAPS and ansible

2020-07-15 Thread harsh chawda
Hello,

I have one doubt like not all systems in my environment are configured with 
LAPS as of now. 

So some of the systems are having LAPS others are having LDAP . So will 
both the things work out.

ie. basically if i install OpenLDAP , is it standalone package/module or 
will it replace the current configuration settings. ie. LDAP 

Thanks for your reply.


On Tuesday, July 14, 2020 at 1:12:56 AM UTC+5:30, jbor...@gmail.com wrote:
>
> Theres the laps_password 
> https://docs.ansible.com/ansible/latest/plugins/lookup/laps_password.html 
> lookup that you can use to retrieve a password set by LAPS from AD. 
> Unfortunately it requires a few extra bits to be installed on your host 
> like OpenLDAP but it's definitely possible.
> On Thursday, July 9, 2020 at 8:52:05 PM UTC+10 harshc...@gmail.com wrote:
>
>> Hello All,
>>
>> I am using ansible for patching windows machines in my domain. The 
>> process is working fine with patches being installed till date over Winrm 
>> and kerberos as authentication.
>>
>> But now they have decided to use LAPS in the environment .So, the 
>> password keep on changing and i am not able to access with the same 
>> password and patch the servers. 
>>
>> So, i tried researching on the internet about it and how to integrate it 
>> with the current setup.But I am not able to do it.
>>
>> Is it feasible and possible with ansible to use LAPS to retrieve password 
>> and patch windows machines as I am patching 5-10 machines at a stretch and 
>> all are having different passwords. And also is it secure to integrate it 
>> with ansible
>>
>> If anyone have used it in their environment and help me out in this ,it 
>> would be great. As, I am completely blank on this and how to integrate it.
>>
>> 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 receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bb10e9fa-49ce-4679-9dba-34f6e7086431o%40googlegroups.com.


Re: [ansible-project] Re: Ansible with Z Open Automation Utilities on z/OS

2020-07-15 Thread Władysław Borysow
Thanks! Will try it:-)

wt., 14.07.2020, 20:01 użytkownik Dakota Heyman 
napisał:

> I have done all of my ansible z/OS stuff by using z/OSMF APIs but your
> syntax looks right from an ansible perspective to me. For ZOA Utilities and
> Ansible zOS Module errors, I would recommend posting a bug about it on
> their official GitHub page:
> https://github.com/ansible-collections/ibm_zos_core/issues
>
> Hope that helps some,
> Dakota Heyman
>
> On Tuesday, July 14, 2020 at 8:45:41 AM UTC-4, Władysław Borysow wrote:
>>
>> Hello,
>>
>> I am testing Ansible 2.9.9 with z/OS as managed node. I also installed
>> ZOA, but it seems ZOA commands from Ansible fail. "Normal" shell commands
>> work well.
>>
>> Some output from my playbooks:
>>
>>
>>
>>
>> *this works fine:*
>>
>>
>>
>>
>> ---
>> - hosts: all
>>   collections:
>> - ibm.ibm_zos_core
>>   gather_facts: no
>>   environment: "{{ environment_vars }}"
>>
>>   tasks:
>>  - name: issue shell command
>>shell: "ls -l"
>>register: result
>>  - name: response
>>debug:
>>  msg: " {{ result }} "
>>
>>
>>
>>
>>
>> *doesn't work:*
>>
>>
>> ---
>> - hosts: all
>>   collections:
>> - ibm.ibm_zos_core
>>   gather_facts: no
>>   environment: "{{ environment_vars }}"
>>   tasks:
>>   - name: test
>> shell: "zoaversion"
>> register: result
>>   - name: Response
>> debug:
>>  msg: "Output from command is {{ result }}"
>>
>>
>> fatal: [zpm]: FAILED! => {"changed": true, "cmd": "zoaversion", "delta":
>> "0:00:02.762870", "end": "2020-07-14 12:37:33.010991", "msg": "non-zero
>> return code", "rc": 1, "start": "2020-07-14 12:37:30.248121", "stderr":
>> "FSUM7341 bad file descriptor \"0\"", "stderr_lines": ["FSUM7341 bad file
>> descriptor \"0\""], "stdout": "", "stdout_lines": []}
>>
>>
>>
>> Is this the right way to call ZOA utilities from Ansible?
>>
>> Thank You,
>>
>> Wladsyslaw
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/9nzxx7qHqTQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ad959a4d-84a7-4e59-ad64-7642fc566768o%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF%2Ba9nyW%3DRF%3D7FswNAVksabsFmzYkUdGxsr%2BKH4QOSY2bwDG1g%40mail.gmail.com.


[ansible-project] Re: Integrating Microsoft LAPS and ansible

2020-07-15 Thread harsh chawda
Hello ,

Thanks for you reply. I will test it out the same.

Thanks again.

On Tuesday, July 14, 2020 at 1:12:56 AM UTC+5:30, jbor...@gmail.com wrote:
>
> Theres the laps_password 
> https://docs.ansible.com/ansible/latest/plugins/lookup/laps_password.html 
> lookup that you can use to retrieve a password set by LAPS from AD. 
> Unfortunately it requires a few extra bits to be installed on your host 
> like OpenLDAP but it's definitely possible.
> On Thursday, July 9, 2020 at 8:52:05 PM UTC+10 harshc...@gmail.com wrote:
>
>> Hello All,
>>
>> I am using ansible for patching windows machines in my domain. The 
>> process is working fine with patches being installed till date over Winrm 
>> and kerberos as authentication.
>>
>> But now they have decided to use LAPS in the environment .So, the 
>> password keep on changing and i am not able to access with the same 
>> password and patch the servers. 
>>
>> So, i tried researching on the internet about it and how to integrate it 
>> with the current setup.But I am not able to do it.
>>
>> Is it feasible and possible with ansible to use LAPS to retrieve password 
>> and patch windows machines as I am patching 5-10 machines at a stretch and 
>> all are having different passwords. And also is it secure to integrate it 
>> with ansible
>>
>> If anyone have used it in their environment and help me out in this ,it 
>> would be great. As, I am completely blank on this and how to integrate it.
>>
>> 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 receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7c6d18d-fc15-48ff-84b9-e58c2dbbeab9o%40googlegroups.com.


Re: [ansible-project] Re: Need to add A record and PRT recored in Cisco switches

2020-07-15 Thread Srinivas Naram
Hello

Can you elaborate your issue and explain the steps taken so far.


On Wed, Jul 15, 2020 at 2:21 PM Balayuvaraj Magudapathi <
bala08yuva...@gmail.com> wrote:

> Hi,
>
> Can any help on this
>
>
>
> On Monday, 13 July 2020 16:48:40 UTC+5:30, Balayuvaraj Magudapathi wrote:
>>
>> Hey,
>>
>> In my environment i need to add a record and prt record in cisco switches
>> for 800 devices.
>>
>> Some share the docs for this project
>>
>> component Name : network module , cisco
>>
>>
>> Thanks
>>
>> Balayuvaraj
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/b7c5fe8e-976d-4033-9eac-a24627a3b297o%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG-N3P7CgtmQcODH6%2BnqxZQJkUt4M9nuwMcXgODo52JP4tXQEw%40mail.gmail.com.


Re: [ansible-project] python unable to install open_excel module for ansible

2020-07-15 Thread Udayendu kar
You can use:

$ sudo  pip3 install openpyxl  -y

I am using this and its working perfectly. 

On Wednesday, July 15, 2020 at 3:26:50 PM UTC+5:30 dick@geant.org wrote:

> Your best bet is to ask the author of that code:
> https://pypi.org/user/mohamedosam/
>
> On Wed, 15 Jul 2020 at 04:46, stack flow  wrote:
> >
> > Hello,
> >
> > I need open_excel module for ansible so that it can read multiple sheets 
> in excel. I am getting following errors. how to fix it? I am using macbook 
> os catalina.
> >
> >
> > ljames@mac ~ % pip3 install open_excel
> > Collecting open_excel
> > Using cached 
> https://files.pythonhosted.org/packages/91/5c/71c6bf1b23d923da947c264aaf3606204aee2bc63ab450fe20a14ab98d63/open_excel-0.101a0.tar.gz
> > Requirement already satisfied: openpyxl in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from open_excel) (3.0.4)
> > Requirement already satisfied: jdcal in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from openpyxl->open_excel) (1.4.1)
> > Requirement already satisfied: et-xmlfile in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from openpyxl->open_excel) (1.0.1)
> > Installing collected packages: open-excel
> > Running setup.py install for open-excel ... error
> > ERROR: Command errored out with exit status 1:
> > command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 
> -u -c 'import sys, setuptools, tokenize; sys.argv[0] = 
> '"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';
>  
> __file__='"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';f=getattr(tokenize,
>  
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-record-kl2pm_3e/install-record.txt
>  
> --single-version-externally-managed --compile
> > cwd: 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/
> > Complete output (14 lines):
> > 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:474:
>  
> UserWarning: Normalizing '0.101a' to '0.101a0'
> > normalized_version,
> > running install
> > running build
> > running build_py
> > creating build
> > creating build/lib
> > creating build/lib/open_excel
> > copying open_excel/search_excel.py -> build/lib/open_excel
> > copying open_excel/__init__.py -> build/lib/open_excel
> > copying open_excel/open_excel.py -> build/lib/open_excel
> > running build_scripts
> > creating build/scripts-3.7
> > error: [Errno 21] Is a directory: 'open_excel'
> > 
> > ERROR: Command errored out with exit status 1: 
> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 
> 'import sys, setuptools, tokenize; sys.argv[0] = 
> '"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';
>  
> __file__='"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';f=getattr(tokenize,
>  
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-record-kl2pm_3e/install-record.txt
>  
> --single-version-externally-managed --compile Check the logs for full 
> command output.
> > WARNING: You are using pip version 19.2.3, however version 20.1.1 is 
> available.
> > You should consider upgrading via the 'pip install --upgrade pip' 
> command.
> > ljames@mac ~ % cd Documents
> >
> > --
> > 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-proje...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/ab9d3d3c-e83c-41a6-860a-de889e1f537do%40googlegroups.com
> .
>
>
>
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a261e5c1-f6c5-4cd2-a23f-291b9904fce1n%40googlegroups.com.


Re: [ansible-project] python unable to install open_excel module for ansible

2020-07-15 Thread Dick Visser
Your best bet is to ask the author of that code:
https://pypi.org/user/mohamedosam/

On Wed, 15 Jul 2020 at 04:46, stack flow  wrote:
>
> Hello,
>
> I need open_excel module for ansible so that it can read multiple sheets in 
> excel. I am getting following errors. how to fix it? I am using macbook os 
> catalina.
>
>
> ljames@mac ~ % pip3 install open_excel
> Collecting open_excel
>   Using cached 
> https://files.pythonhosted.org/packages/91/5c/71c6bf1b23d923da947c264aaf3606204aee2bc63ab450fe20a14ab98d63/open_excel-0.101a0.tar.gz
> Requirement already satisfied: openpyxl in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from open_excel) (3.0.4)
> Requirement already satisfied: jdcal in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from openpyxl->open_excel) (1.4.1)
> Requirement already satisfied: et-xmlfile in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (from openpyxl->open_excel) (1.0.1)
> Installing collected packages: open-excel
>   Running setup.py install for open-excel ... error
> ERROR: Command errored out with exit status 1:
>  command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 
> -u -c 'import sys, setuptools, tokenize; sys.argv[0] = 
> '"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';
>  
> __file__='"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';f=getattr(tokenize,
>  '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-record-kl2pm_3e/install-record.txt
>  --single-version-externally-managed --compile
>  cwd: 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/
> Complete output (14 lines):
> 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:474:
>  UserWarning: Normalizing '0.101a' to '0.101a0'
>   normalized_version,
> running install
> running build
> running build_py
> creating build
> creating build/lib
> creating build/lib/open_excel
> copying open_excel/search_excel.py -> build/lib/open_excel
> copying open_excel/__init__.py -> build/lib/open_excel
> copying open_excel/open_excel.py -> build/lib/open_excel
> running build_scripts
> creating build/scripts-3.7
> error: [Errno 21] Is a directory: 'open_excel'
> 
> ERROR: Command errored out with exit status 1: 
> /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import 
> sys, setuptools, tokenize; sys.argv[0] = 
> '"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';
>  
> __file__='"'"'/private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-install-7rj4t72f/open-excel/setup.py'"'"';f=getattr(tokenize,
>  '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', 
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' 
> install --record 
> /private/var/folders/l8/gjnzx82j2fbd8dqjdxvmx794gn/T/pip-record-kl2pm_3e/install-record.txt
>  --single-version-externally-managed --compile Check the logs for full 
> command output.
> WARNING: You are using pip version 19.2.3, however version 20.1.1 is 
> available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
> ljames@mac ~ % cd Documents
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/ab9d3d3c-e83c-41a6-860a-de889e1f537do%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwP2cSOwSLk2XqZ_HaGOVhvEqy3rbJ5sbDNyjbv-GGDGUg%40mail.gmail.com.


Re: [ansible-project] 'win_partition' is unable to resize the hdd

2020-07-15 Thread Udayendu kar
Finally able to connect to the windows guest after doing some setting 
change in the WinRM inside the guest but 'win_partition' is creating a new 
partition instead of extending one:

# cat ../inventory
[windows]
xxx.xxx.xxx.xxx

[windows:vars]
ansible_connection=winrm
ansible_user=Administrator
ansible_password=xx
ansible_winrm_transport=basic
ansible_winrm_server_cert_validation=ignore
ansible_port=5985

# cat disk.yaml
---
- name: Extend the C drive to the max space
  hosts: "{{ target }}"
  gather_facts: false
  connection: winrm

  tasks:
- name: Disk extension
  win_partition:
state: present
partition_size: -1
partition_number: 0
disk_number: 0

# ansible-playbook  -i ../inventory -e target=windows disk.yaml

PLAY [Extend the C drive to the max space] 
***

TASK [Disk extension] 
***
changed: [xxx.xxx.xxx.xxx]

PLAY RECAP 
***
xxx.xxx.xxx.xxx  : ok=1changed=1unreachable=0
failed=0skipped=0rescued=0ignored=0

On Wednesday, July 15, 2020 at 1:55:48 PM UTC+5:30 manashm...@gmail.com 
wrote:

> u001b[91munexpected token '\u', expected 'begin', 'process', 'end', 
> or\n\u001b[96m | \u001b[91m'dynamicparam'.\n\u001b[0m\n", 
> "module_stdout": "", "msg": "MODULE
>
> Answer is unexpected tokens
>
> On Wed, 15 Jul 2020, 11:04 Udayendu kar,  wrote:
>
>> Disk resize code:
>>
>> ```
>> - name: Extend the C drive to the max space 
>>win_partition: 
>>partition_size: -1 
>>partition_number: 0 
>>disk_number: 0  
>> ```
>>
>> Error message:
>>
>> ```
>> TASK [Extend the C drive to the max space] 
>> ***
>>  
>> task path: /root/Windows/win-deploy.yaml:70 <127.0.0.1> ESTABLISH LOCAL 
>> CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 
>> 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
>> /root/.ansible/tmp `"&& mkdir 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 && 
>> echo ansible-tmp-1594746664.821915-2548-136259556554737="` echo 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 `" ) 
>> && sleep 0' Using module file 
>> /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_partition.ps1
>>  
>> <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-2331o41jvcot/tmp54wxtp0v 
>> TO 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>  
>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/ 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>  
>> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'powershell 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>  
>> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r 
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/ > 
>> /dev/null 2>&1 && sleep 0' fatal: [localhost]: FAILED! => { "changed": 
>> false, "module_stderr": "\u001b[91mParserError: 
>> \u001b[0m/root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1:151\n\u001b[96mLine
>>  
>> |\n\u001b[96m 151 | \u001b[0m 
>> \u001b[96m\u\u001b[0m\u\u\u{\"module_entry\": 
>> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTg …\n\u001b[96m | 
>> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token '\u', 
>> expected 'begin', 'process', 'end', or\n\u001b[96m | 
>> \u001b[91m'dynamicparam'.\n\u001b[0m\n", "module_stdout": "", "msg": 
>> "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } 
>> ``` 
>>
>> -- 
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4304d693-9447-4a4b-9018-61fd2438dc82n%40googlegroups.com
>>  
>> 

[ansible-project] Re: Need to add A record and PRT recored in Cisco switches

2020-07-15 Thread Balayuvaraj Magudapathi
Hi,

Can any help on this



On Monday, 13 July 2020 16:48:40 UTC+5:30, Balayuvaraj Magudapathi wrote:
>
> Hey,
>
> In my environment i need to add a record and prt record in cisco switches 
> for 800 devices.
>
> Some share the docs for this project
>
> component Name : network module , cisco
>
>
> Thanks
>
> Balayuvaraj
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7c5fe8e-976d-4033-9eac-a24627a3b297o%40googlegroups.com.


Re: [ansible-project] ansible check and diff mode not working

2020-07-15 Thread Shyam Sunder
I am sure if that is true. Because I could reproduce this for other network 
modules also like (exos_config, eos_config). In the first tutorial (
https://blog.networktocode.com/post/generating-diff-with-ansible/) I 
posted, its mentioned that these module support diff & check mode. But no 
sample exits online. Somehow its not working for me. I thought someone 
could guide with this.

-Shyam

On Wednesday, July 15, 2020 at 2:00:45 PM UTC+5:30, Stefan Hornburg (Racke) 
wrote:
>
> On 7/15/20 10:08 AM, Shyam Sunder wrote: 
> > Thanks for reply. Yes below is my intended config - 
> > | 
> > ntp server 10.19.70.1 
> > | 
> > 
> > But on device we have different ntp server configured - 
> > | 
> > ntp server 10.19.60.9 
> > | 
> > * 
> > Here in updates section, ansible guiding me that its going to push this 
> NTP config. But what config already exits is not 
> > mentioned or pushing against what config is not shown. Do anyone has any 
> working example of this? 
> > 
> > Why there is a warning shown that it can't diff when check mode is 
> enabled? In documentation 
> > (
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_checkmode.html) 
> its 
> mentioned that we can use these together.* 
>
> It looks like a shortcoming of this module. Usually --check and --diff 
> works together without hassle. 
>
> Regards 
>Racke 
>
> > 
> > -Shyam 
> > 
> > On Wednesday, July 15, 2020 at 12:55:23 PM UTC+5:30, Srinivas Naram 
> wrote: 
> > 
> > Hello Shyam 
> > 
> > It is how the output is displayed. In your output updates are 
> showing the difference in running config and your cfg 
> > file.   
> > 
> > "updates": [ 
> > "configure ntp server add x.x.x.x" 
> > ],  
> > 
> > I don't see any issue with the output. Did you try changing the ntp 
> setting on the device yourself and check out the 
> > difference in output ? 
> > 
> > On Tue, Jul 14, 2020 at 11:16 PM Shyam Sunder  > wrote: 
> > 
> > Hi, 
> > 
> > 
> > I was going thru this post (
> https://blog.networktocode.com/post/generating-diff-with-ansible/ 
> > <
> https://blog.networktocode.com/post/generating-diff-with-ansible/>) where 
> its mentioned that we can use check 
> > and diff mode together. I am trying to use that for gold config 
> audit (audit pre decided config against what is 
> > present on device) for Cisco and Extreme devices. Below is my 
> playbook – 
> > 
> > 
> > | 
> > # task to audit & heal ntp configuration 
> > -name:SetNTP template 
> >   ios_config: 
> >  src:"{{domain}}_{{ansible_network_os}}_ntp.cfg" 
> >  match:line 
> >   register:ntp_result 
> > | 
> > 
> > 
> >  
> > 
> > Below is my template - 
> > 
> >  
> > 
> > | 
> > ntp server 10.19.70.1 
> > | 
> > 
> >  
> > 
> > *Ansible highlighting that it is going to change the config. 
> Below is what result I am getting. Surprisingly I 
> > am not getting any config diff.* 
> > 
> >  
> > 
> > 
> > | 
> > "ntp_result":{ 
> > "ansible_facts":{ 
> > "discovered_interpreter_python":"/usr/bin/python" 
> > }, 
> > "changed":true, 
> > "commands":[ 
> > "configure ntp server add x.x.x.x" 
> > ], 
> > "failed":false, 
> > "updates":[ 
> > "configure ntp server add x.x.x.x" 
> > ], 
> > "warnings":[ 
> > "unable to perform diff against running-config due 
> to check mode" 
> > ] 
> > } 
> > | 
> > 
> > 
> >  
> > 
> > 
> > *Why I am not getting config diff? Any idea what is wrong?* 
> > 
> > -- 
> > 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...@googlegroups.com 
> > . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/cc54e580-7642-4c51-a093-4a691b85cd2fo%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/ansible-project/cc54e580-7642-4c51-a093-4a691b85cd2fo%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
> > 
> > -- 
> > 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...@googlegroups.com   ansible-project+unsubscr...@googlegroups.com >. 
> > To view this discussion on the web visit 
> > 
> 

Re: [ansible-project] ansible check and diff mode not working

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 10:08 AM, Shyam Sunder wrote:
> Thanks for reply. Yes below is my intended config -
> |
> ntp server 10.19.70.1
> |
> 
> But on device we have different ntp server configured -
> |
> ntp server 10.19.60.9
> |
> *
> Here in updates section, ansible guiding me that its going to push this NTP 
> config. But what config already exits is not
> mentioned or pushing against what config is not shown. Do anyone has any 
> working example of this?
> 
> Why there is a warning shown that it can't diff when check mode is enabled? 
> In documentation
> (https://docs.ansible.com/ansible/latest/user_guide/playbooks_checkmode.html) 
> its mentioned that we can use these together.*

It looks like a shortcoming of this module. Usually --check and --diff works 
together without hassle.

Regards
   Racke

> 
> -Shyam
> 
> On Wednesday, July 15, 2020 at 12:55:23 PM UTC+5:30, Srinivas Naram wrote:
> 
> Hello Shyam
> 
> It is how the output is displayed. In your output updates are showing the 
> difference in running config and your cfg
> file.  
> 
> "updates": [
>             "configure ntp server add x.x.x.x"
>         ], 
> 
> I don't see any issue with the output. Did you try changing the ntp 
> setting on the device yourself and check out the
> difference in output ?
> 
> On Tue, Jul 14, 2020 at 11:16 PM Shyam Sunder  > wrote:
> 
> Hi,
> 
> 
> I was going thru this post 
> (https://blog.networktocode.com/post/generating-diff-with-ansible/
> ) 
> where its mentioned that we can use check
> and diff mode together. I am trying to use that for gold config audit 
> (audit pre decided config against what is
> present on device) for Cisco and Extreme devices. Below is my 
> playbook –
> 
> 
> |
> # task to audit & heal ntp configuration
> -name:SetNTP template
>   ios_config:
>      src:"{{domain}}_{{ansible_network_os}}_ntp.cfg"
>      match:line
>   register:ntp_result
> |
> 
> 
> 
> 
> Below is my template -
> 
> 
> 
> |
> ntp server 10.19.70.1
> |
> 
> 
> 
> *Ansible highlighting that it is going to change the config. Below is 
> what result I am getting. Surprisingly I
> am not getting any config diff.*
> 
> 
> 
> 
> |
> "ntp_result":{
>         "ansible_facts":{
>             "discovered_interpreter_python":"/usr/bin/python"
>         },
>         "changed":true,
>         "commands":[
>             "configure ntp server add x.x.x.x"
>         ],
>         "failed":false,
>         "updates":[
>             "configure ntp server add x.x.x.x"
>         ],
>         "warnings":[
>             "unable to perform diff against running-config due to 
> check mode"
>         ]
>     }
> |
> 
> 
> 
> 
> 
> *Why I am not getting config diff? Any idea what is wrong?*
> 
> -- 
> 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...@googlegroups.com
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/cc54e580-7642-4c51-a093-4a691b85cd2fo%40googlegroups.com
> 
> .
> 
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1be4d964-ae70-4e72-a351-d6bed135c383o%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/08435cc0-34a8-3ebd-5b86-4507a6631816%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] 'win_partition' is unable to resize the hdd

2020-07-15 Thread CORLEONE##
u001b[91munexpected token '\u', expected 'begin', 'process', 'end',
or\n\u001b[96m | \u001b[91m'dynamicparam'.\n\u001b[0m\n", "module_stdout":
"", "msg": "MODULE

Answer is unexpected tokens

On Wed, 15 Jul 2020, 11:04 Udayendu kar,  wrote:

> Disk resize code:
>
> ```
> - name: Extend the C drive to the max space
>win_partition:
>partition_size: -1
>partition_number: 0
>disk_number: 0
> ```
>
> Error message:
>
> ```
> TASK [Extend the C drive to the max space]
> ***
> task path: /root/Windows/win-deploy.yaml:70 <127.0.0.1> ESTABLISH LOCAL
> CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep
> 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
> /root/.ansible/tmp `"&& mkdir
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 &&
> echo ansible-tmp-1594746664.821915-2548-136259556554737="` echo
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 `" )
> && sleep 0' Using module file
> /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_partition.ps1
> <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-2331o41jvcot/tmp54wxtp0v
> TO
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'powershell
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r
> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/ >
> /dev/null 2>&1 && sleep 0' fatal: [localhost]: FAILED! => { "changed":
> false, "module_stderr": "\u001b[91mParserError:
> \u001b[0m/root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1:151\n\u001b[96mLine
> |\n\u001b[96m 151 | \u001b[0m
> \u001b[96m\u\u001b[0m\u\u\u{\"module_entry\":
> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTg …\n\u001b[96m |
> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token '\u',
> expected 'begin', 'process', 'end', or\n\u001b[96m |
> \u001b[91m'dynamicparam'.\n\u001b[0m\n", "module_stdout": "", "msg":
> "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }
> ```
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4304d693-9447-4a4b-9018-61fd2438dc82n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEaHSXbZhzaXYAr_AO8J-01e6tA8v3DMB%3DKh2541o3BW%3DpsLQQ%40mail.gmail.com.


Re: [ansible-project] ansible check and diff mode not working

2020-07-15 Thread Shyam Sunder
Thanks for reply. Yes below is my intended config -
ntp server 10.19.70.1

But on device we have different ntp server configured -
ntp server 10.19.60.9



*Here in updates section, ansible guiding me that its going to push this 
NTP config. But what config already exits is not mentioned or pushing 
against what config is not shown. Do anyone has any working example of 
this?Why there is a warning shown that it can't diff when check mode is 
enabled? In documentation 
(https://docs.ansible.com/ansible/latest/user_guide/playbooks_checkmode.html 
) 
its 
mentioned that we can use these together.*

-Shyam

On Wednesday, July 15, 2020 at 12:55:23 PM UTC+5:30, Srinivas Naram wrote:
>
> Hello Shyam
>
> It is how the output is displayed. In your output updates are showing the 
> difference in running config and your cfg file.  
>
> "updates": [
> "configure ntp server add x.x.x.x"
> ], 
>
> I don't see any issue with the output. Did you try changing the ntp 
> setting on the device yourself and check out the difference in output ?
>
> On Tue, Jul 14, 2020 at 11:16 PM Shyam Sunder  > wrote:
>
>> Hi,
>>
>>
>> I was going thru this post (
>> https://blog.networktocode.com/post/generating-diff-with-ansible/) where 
>> its mentioned that we can use check and diff mode together. I am trying to 
>> use that for gold config audit (audit pre decided config against what is 
>> present on device) for Cisco and Extreme devices. Below is my playbook –
>>
>>
>> # task to audit & heal ntp configuration
>> - name: Set NTP template 
>>   ios_config: 
>>  src: "{{domain}}_{{ansible_network_os}}_ntp.cfg" 
>>  match: line 
>>   register: ntp_result
>>
>>
>> Below is my template -
>>
>> ntp server 10.19.70.1
>>
>> *Ansible highlighting that it is going to change the config. Below is 
>> what result I am getting. Surprisingly I am not getting any config diff.*
>>
>>
>> "ntp_result": {
>> "ansible_facts": { 
>> "discovered_interpreter_python": "/usr/bin/python" 
>> }, 
>> "changed": true, 
>> "commands": [ 
>> "configure ntp server add x.x.x.x" 
>> ], 
>> "failed": false, 
>> "updates": [ 
>> "configure ntp server add x.x.x.x" 
>> ], 
>> "warnings": [ 
>> "unable to perform diff against running-config due to check 
>> mode" 
>> ] 
>> }
>>
>>
>>
>> *Why I am not getting config diff? Any idea what is wrong?*
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/cc54e580-7642-4c51-a093-4a691b85cd2fo%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1be4d964-ae70-4e72-a351-d6bed135c383o%40googlegroups.com.


[ansible-project] 'win_partition' is unable to resize the hdd

2020-07-15 Thread Jordan Borean
So you are running a PowerShell module on localhost which won’t work. How have 
you defined your inventory, how are you targeting that host in your play?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fe27ccf1-4009-4dcc-aa01-25634bbb46fbo%40googlegroups.com.


Re: [ansible-project] ansible check and diff mode not working

2020-07-15 Thread Srinivas Naram
Hello Shyam

It is how the output is displayed. In your output updates are showing the
difference in running config and your cfg file.

"updates": [
"configure ntp server add x.x.x.x"
],

I don't see any issue with the output. Did you try changing the ntp setting
on the device yourself and check out the difference in output ?

On Tue, Jul 14, 2020 at 11:16 PM Shyam Sunder 
wrote:

> Hi,
>
>
> I was going thru this post (
> https://blog.networktocode.com/post/generating-diff-with-ansible/) where
> its mentioned that we can use check and diff mode together. I am trying to
> use that for gold config audit (audit pre decided config against what is
> present on device) for Cisco and Extreme devices. Below is my playbook –
>
>
> # task to audit & heal ntp configuration
> - name: Set NTP template
>   ios_config:
>  src: "{{domain}}_{{ansible_network_os}}_ntp.cfg"
>  match: line
>   register: ntp_result
>
>
> Below is my template -
>
> ntp server 10.19.70.1
>
> *Ansible highlighting that it is going to change the config. Below is what
> result I am getting. Surprisingly I am not getting any config diff.*
>
>
> "ntp_result": {
> "ansible_facts": {
> "discovered_interpreter_python": "/usr/bin/python"
> },
> "changed": true,
> "commands": [
> "configure ntp server add x.x.x.x"
> ],
> "failed": false,
> "updates": [
> "configure ntp server add x.x.x.x"
> ],
> "warnings": [
> "unable to perform diff against running-config due to check
> mode"
> ]
> }
>
>
>
> *Why I am not getting config diff? Any idea what is wrong?*
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/cc54e580-7642-4c51-a093-4a691b85cd2fo%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG-N3P6SRZp66MWxSQjcodyZF8Mj73k9ePzKArGFmH9Tdn6mqg%40mail.gmail.com.