Re: [ansible-project] Listing installed packages

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 19:21, lift...@gmail.com a écrit :

I know I can use the package_facts module to retrieve a list of
installed packages, but I'm having trouble formatting these.  I'd like
to format it similar to the following:

Package:   Version: 

Currently I'm doing the following (I'm showing only httpd but
ultimately I'd like to list out ALL installed packages:

---
- hosts: localhost
  become: true
  become_method: sudo
  gather_facts: no

  tasks:

  - name: Get installed packages
package_facts:
register: packages

  - name: Debug output

debug:
  msg: "{{ packages.ansible_facts.packages['httpd'] }}"

The debug print is giving me the following:

TASK [Debug output]
**
ok: [localhost] => {
"msg": [
{
"arch": "x86_64",
"epoch": null,
"name": "httpd",
"release": "97.el7_9",
"source": "rpm",
"version": "2.4.6"
}
]
}

Any ideas?

Thanks,
Harry


You can use templating to have it on one line...

But be careful :
- you can have more than one version of a package installed. Example: 
kernel
- you can have one x86_64 and one i686 or i386 version of a package 
installed


Regards,


--
Jean-Yves LENHOF

--
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/c35818c74a992704b45ffa2bc82c755e%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread 'Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 14:14, dulhaver via Ansible Project a écrit :
On 10/14/2021 1:44 PM Sandip Bhattacharya 
 wrote:



On 14.10.21 11:49, dulhaver via Ansible Project wrote:
> I am running a playbook to install postgresql <https://paste.debian.net/1215359/> 
against a centos7 (python 2.75) target and am getting this error about a bad python 
interpreter <https://paste.debian.net/1215357/>.
>
> I try to solve this via the inventory.yml
>
> all:
>    hosts:
>      [hostname]: # centos7

Is this literally what is in your inventory.yaml file? Is that even 
valid yaml?

Shouldn't it be:

all:
   hosts:
 hostname: # centos7


this is my literal inventory file: https://paste.debian.net/1215386/
it works for other playbooks, it works for ad-hoc commands (where I
addresse a particular host from that group)


Did you surcharge the python interpreter variable in a config file ? 
(/etc/ansible.cfg, ~/.ansible.cfg, etc...)


See:
https://docs.ansible.com/ansible/latest/reference_appendices/config.html

Regards,

--
Jean-Yves LENHOF

--
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/1a5189ff5c956aa7b82a6352ee28cc1a%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 13:05, dulhaver via Ansible Project a écrit :
On 10/14/2021 12:59 PM 'Jean-Yves LENHOF' via Ansible Project 
 wrote:



Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :
> thx for the hint
>
>> On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project
>>  wrote:
>>
>> Maybe something wrong with alternatives ?
>> > alternatives --list | grep -i python
>
> turns out empty.
>
> have tried to get something working with
>> alternatives --install /usr/bin/python python /usr/bin/python2.7
>
> (where /usr/bin/python is already a symlink to /usr/bin/python2 which
> is a symlink to /usr/bin/python2.7). It did not change anything
> though.
>
> probably it's my incompetence. I never heard about alternatives before
> (and don't really get it, as I thought the symlinks /usr/bin/python >
> /usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
> anybody looking for python to the right executable. Neither do I get
> why all of a sudden a playbook requires this where opther playbooks
> running against the exact same host haven't.


Running from the same controller server with the same ansible version 
?


no, I ran all that on the target. doing that on the Ansible controller
server I get:

alternatives --list | grep python
python  manual  /usr/bin/python3
python3 auto/usr/bin/python3.6


That's not what I was asking... But you answer indirectly to one of my 
questions.

You have only one ansible controller as I understand.

You seems to say that there were some playbooks which works OK and some 
don't on the same targets.
Do you use the same ansible version for the the one which are OK and not 
OK ? There were some changes between versions of ansible for the python 
default interpreter search
Do you use the same inventory ? If not did you force the ansible python 
interpreter on one and not the other ?




Regards,

--
Jean-Yves LENHOF

--
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/2a183e1d76dca48acb64c88e5695ecf9%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 12:56, dulhaver via Ansible Project a écrit :

thx for the hint

On 10/14/2021 12:16 PM 'Jean-Yves LENHOF' via Ansible Project 
 wrote:


Maybe something wrong with alternatives ?
> alternatives --list | grep -i python


turns out empty.

have tried to get something working with

alternatives --install /usr/bin/python python /usr/bin/python2.7


(where /usr/bin/python is already a symlink to /usr/bin/python2 which
is a symlink to /usr/bin/python2.7). It did not change anything
though.

probably it's my incompetence. I never heard about alternatives before
(and don't really get it, as I thought the symlinks /usr/bin/python >
/usr/bin/python2 > /usr/bin/python2.7) should be sufficient to guide
anybody looking for python to the right executable. Neither do I get
why all of a sudden a playbook requires this where opther playbooks
running against the exact same host haven't.



Running from the same controller server with the same ansible version ?

Regards,

--
Jean-Yves LENHOF

--
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/1f0e8552caa6b1ddc9383ecc654a307f%40lenhof.eu.org.


Re: [ansible-project] centos7 target - sudden python interpreter trouble

2021-10-14 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-10-14 11:49, dulhaver via Ansible Project a écrit :

I am running a playbook to install postgresql [1] against a centos7
(python 2.75) target and am getting this error about a bad python
interpreter [2].

 I try to solve this via the inventory.yml

 all:
  hosts:
 [hostname]: # centos7
  ansible_host: my.domain.org
  ansible_user: username
  ansible_python_interpreter: /usr/bin/python

 (also tried interpreter_python: /usr/bin/python). the error remains
though

 funny fact ... I ran other playbooks successfully against the same
host before even without having specified any python interpreter.

 any ideas what may be going wrong here?





Hi,

Maybe something wrong with alternatives ?

alternatives --list | grep -i python


Regards,

--
Jean-Yves LENHOF

--
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/bb6de9cb59fd3403fcedc2bf37eb7bdd%40lenhof.eu.org.


Re: [ansible-project] lvol module - depency problem parted/gparted

2021-10-12 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-10-12 14:50, dulhaver via Ansible Project a écrit :

> > On 10/12/2021 1:31 PM 'Jean-Yves LENHOF' via Ansible Project 
 wrote:
> >
> > parted package is available. You probably are doing something wrong
> > A "dnf update" and "dnf install parted" should work !

Alright, that might be the right push. Seems it could be a matter of 
enabled repos on the target. I guess I'll have to look at the 
`enablerepo` paramter in order to solve this


seems I can not get it working though


 tasks

  - name: install gparted & xfsprogs on target
dnf:
  name:
- parted
  enablerepo: rhel-8-for-x86_64-baseos-rpms
  state: present
become: yes

still does not seem to work "failures: No package parted available."
(and "rhel-8-for-x86_64-baseos-rpms" seems to be the repo needed)



Try using properties "update_cache" to "yes" for your dnf module use

Regards,

JYL


--
Jean-Yves LENHOF

--
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/8c41dcb98b0c91120e4b8b7ae653f35e%40lenhof.eu.org.


Re: [ansible-project] lvol module - depency problem parted/gparted

2021-10-12 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-10-12 12:25, dulhaver via Ansible Project a écrit :

I have a task to resize a logical volume on a rhel8 target with the
lvol module.

 1. I get prompted 'Failed to find required executable parted'

 2. trying to install it with dnf module tells me 'parted does not
exist'

 3. trying gparted alternatively gives me a whole bndh of missing
dependencies

 msg: |-
Depsolve Error occured:
Problem: conflicting requests
- nothing provides libglibmm-2.4.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libsigc-2.0.so.0()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libgiomm-2.4.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libparted.so.2()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libparted-fs-resize.so.0()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides
libparted-fs-resize.so.0(LIBPARTED_FS_RESIZE_0.0.0)(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libatkmm-1.6.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libcairomm-1.0.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libgdkmm-3.0.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libgtkmm-3.0.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
- nothing provides libpangomm-1.4.so.1()(64bit) needed by
gparted-1.2.0-1.el8.x86_64
rc: 1
results: []

 my understanding was that gparted the gui version of parted (but that
easily might be worng understanding on my part)

 can anybody point out where I am taking a wrong turn here and push me
into the right direction?




parted package is available. You probably are doing something wrong
A "dnf update" and "dnf install parted" should work !


Regards,


--
Jean-Yves LENHOF

--
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/c042920bf2e53c208bbf1b5a4c19e155%40lenhof.eu.org.


Re: [ansible-project] Custom facts written using resource module builder

2021-09-05 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Show us the code and different results when it works and when it don't

Regards,

Le 05/09/2021 à 11:15, nitesh shet a écrit :

Hi,
I had written a custom facts for NTP server but it is acting weirdly 
everytime i run the facts module using playbook , sometimes values 
will come and sometimes not.
Can you please help me with this, is this the problem with builders or 
do i need to add a seperate class for connection?


Thanks,
Nitesh
--
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/CAPgfy9WpcjHFN-XfAgmPoR%3DZ0amF3ERX6-C-wENpdJV4C5Pg2Q%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/bf12d53f-d566-6660-6b8e-dd143542c5a8%40lenhof.eu.org.


Re: [ansible-project] Permission Denied error

2021-09-03 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Hi,

Look at your /etc/ansible.cfg $HOME/.ansible.cfg in your home or your 
inventories files, you probably surcharge ansible_ssh_common_args 
somewhere !


Regards,


Le 03/09/2021 à 16:43, aman kumar chagti a écrit :
I'm manually able to log in to target VM by password...but no thru 
ansible..even I tried to use the private key as well..but still the 
same issue coming up...


On Friday, September 3, 2021 at 8:10:49 PM UTC+5:30 aman kumar chagti 
wrote:


 PasswordAuthentication: is set to *yes*.. on both target and
controller servers. FYI
On Friday, September 3, 2021 at 8:08:50 PM UTC+5:30 aman kumar
chagti wrote:

on the target server or on controller server??

On Friday, September 3, 2021 at 7:54:28 PM UTC+5:30
e.ht...@gmail.com wrote:

Verify if PasswordAuthentication is set to yes in the
/etc/ssh/sshd_config and restart the sshd service on the
managed node.

On Fri, Sep 3, 2021, 3:07 PM aman kumar chagti
 wrote:

hi, I used - option, and I found something
.
/SH: EXEC ssh -vvv -C -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no
-o

PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
/-o PasswordAuthentication=no/-o 'User="seconize"' -o
ConnectTimeout=10 -o
ControlPath=/home/wyxadministrator/.ansible/cp/68474f4208
x.y.z.x '/bin/sh -c '"'"'echo ~hello && sleep 0'"'"'' /



--
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/a191df15-164d-151d-98d7-4acc25272ed7%40lenhof.eu.org.


Re: [ansible-project] Permission Denied error

2021-09-02 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

The ssh test you made is using the ansible controller server ?

Are you sure you are using the good ansible user on the target host ? 
(-u parameter for ansible-playbook)


Regards,

JY

Le 02/09/2021 à 14:48, aman kumar chagti a écrit :

yes, sshpass is inistalled


On Thursday, September 2, 2021 at 6:06:44 PM UTC+5:30 
jyle...@gmail.com wrote:


If you want password authentication, you need sshpass on your
ansible controller server. Did you install it ?

Regards,

JYL


Le 02/09/2021 à 13:55, aman kumar chagti a écrit :

when I try to run the playbook on a remote VM using
password-based  authentication, I'm getting the following error:
*fatal: [X.X.X.X]: UNREACHABLE! => {"changed": false, "msg":
"Failed to connect to the host via ssh: x...@X.X.X.X: Permission
denied (publickey,password).", "unreachable": true}
*user and password are present in the inventory file.
but when I try to connect to the VM manually by SSH and using
that same password: I'm able to log it. Can anyone figure the
solution?
-- 
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/622ba01f-b89b-49f0-91e2-319f6daee852n%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/72ef230c-8b8b-4ef8-a03a-3d897e356235n%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/76647214-101b-8f34-7161-02ea3d48e5ea%40lenhof.eu.org.


Re: [ansible-project] Permission Denied error

2021-09-02 Thread &#x27;Jean-Yves LENHOF' via Ansible Project



Le 02/09/2021 à 14:53, aman kumar chagti a écrit :

@jyle if sshpass needs to be installed on target VM as well??



Nope, only on server side

Regards,


JYL

--
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/7bc2b31f-35f1-2aac-b03f-18a32defded7%40lenhof.eu.org.


Re: [ansible-project] Permission Denied error

2021-09-02 Thread &#x27;Jean-Yves LENHOF' via Ansible Project
If you want password authentication, you need sshpass on your ansible 
controller server. Did you install it ?


Regards,

JYL


Le 02/09/2021 à 13:55, aman kumar chagti a écrit :
when I try to run the playbook on a remote VM using password-based  
authentication, I'm getting the following error:
*fatal: [X.X.X.X]: UNREACHABLE! => {"changed": false, "msg": "Failed 
to connect to the host via ssh: x...@X.X.X.X: Permission denied 
(publickey,password).", "unreachable": true}

*user and password are present in the inventory file.
but when I try to connect to the VM manually by SSH and using that 
same password: I'm able to log it. Can anyone figure the solution?

--
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/622ba01f-b89b-49f0-91e2-319f6daee852n%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/f3cb0095-e9f5-3344-0584-1e131fc25557%40lenhof.eu.org.


Re: [ansible-project] Winrm configuration issue

2021-07-22 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Hi,

Is the account local and your GPO (seems that there are some) does'nt 
allow to log in with this account remotely ?


Regards,

JYL


Le 22/07/2021 à 12:09, Thanh Nguyen Duc a écrit :

Hi

I have tried to reset password, telnet to client. All ok. Even tried 
to use the service account to login server locally and successful.


Thanks and Regards,

Thanh.

Sent from my iPhone


On 22 Jul 2021, at 17:49, Kundan Singh  wrote:


Please try reseting password and check port on server also validate 
connectivity work from controller server


Regards
Kundan singh

On Thu, Jul 22, 2021, 2:13 PM Thanh Nguyen Duc 
mailto:ng.ducthanh1...@gmail.com>> wrote:


Hi experts,

I have an ansible server managing a lot of windows servers.
Recently I encountered an issue with a few client with the error
below.

-- 
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/696E3CDB-CFCA-4298-9765-CA4589D5B258%40gmail.com

.


I have tried many things like verify the cert with wirm, compare
tls, ssl… but no difference with the working one. All look good.
Hope someone encountered it before and manage to solve it

-- 
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/696E3CDB-CFCA-4298-9765-CA4589D5B258%40gmail.com

.


Thank you so much for your advice in advance.

Best Regards,

Thanh.

-- 
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/696E3CDB-CFCA-4298-9765-CA4589D5B258%40gmail.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/CADGcVU3fVVpibb70zN3BFXVYCfvS%3DVm0v%2BDoxCM1rvx4Jd5nfA%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/B5563EC8-D0BE-40BA-AB69-C61D55655EBD%40gmail.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/c6955ad2-bb63-4724-d26f-eaaccaefce30%40lenhof.eu.org.


[ansible-project] Re: Install a french version of SQLServer on an english windows server with ansible

2021-06-26 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Le 2021-06-24 19:08, Jean-Yves LENHOF a écrit :

Hi,


I try to silently install a french version of SQLServer (this is not
my idea, it's become this is the licensed version we have) with
ansible using some code like this (I already installed MUI French lang
pack via ansible) :

- name: "Change LANG"
  win_shell: |
Set-WinUILanguageOverride -Language fr-FR

- name: "Silent Install of SQL Server 2019"
  win_shell: |
D:\SETUP.EXE
/ConfigurationFile=c:\Windows\ansible_SQLSERVER2019_EXPRESS_ConfigurationFile.ini
/SAPWD=MySuperPassw0rd /IAcceptSQLServerLicenseTerms

But it keeps saying that there's something wrong with my language...

fatal: [myserver]: FAILED! => {
"changed": true,
"cmd": "D:\\SETUP.EXE
/ConfigurationFile=c:\\Windows\\ansible_SQLSERVER2019_EXPRESS_ConfigurationFile.ini
/SAPWD=MySuperPassw0rd /IAcceptSQLServerLicenseTerms",
"delta": "0:00:00.531238",
"end": "2021-06-24 04:13:53.809159",
"msg": "non-zero return code",
"rc": 1,
"start": "2021-06-24 04:13:53.277921",
"stderr": "",
"stderr_lines": [],
"stdout": "This SQL Server setup media does not support the
language of the OS, or does not have the SQL Server English-language
version installation files.  Use the matching language-specific SQL
Server media; or install  both the language specific MUI and change
the format and system locales through the regional settings in the
control panel.\r\n\r\n\r\n\r\n",
"stdout_lines": [
"This SQL Server setup media does not support the language of
the OS, or does not have the SQL Server English-language version
installation files.  Use the matching language-specific SQL Server
media; or install  both the language specific MUI and change the
format and system locales through the regional settings in the control
panel.",
"",
"",
""
]
}

But If I'm connecting on the server the UI Lang is changed to French
(so this part seems to work) and if I run the command line on
powershell it succeed.
On Linux I would have just surcharged LANG parameter before my command
but on windows, I think this is not possible...

Is there's something on ansible which force the language to english ?
If not, is someone has an idea on what's going on...

Thanks


Regards,



Fucking off Windows !

Little followup, because that was a quite difficult one to found.
It seems that windows does'nt directly changed tue UI Language when we 
do it programmatically the configuration is pending an interactive 
connection to that user make actually the change
Here's the registry key difference I found (note the pending in the 
entry) :


Control Panel\Desktop

-"PreferredUILanguages"=hex(7):66,00,72,00,2d,00,46,00,52,00,00,00^M
+"PreferredUILanguagesPending"=hex(7):66,00,72,00,2d,00,46,00,52,00,00,00^M

I will have just to create directly this key in the hive of my ansible 
user to have the right language directly I think...



Regards,

--
Jean-Yves LENHOF
jean-y...@lenhof.eu.org

--
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/af389056acd4984745a0707bc723e670%40lenhof.eu.org.


[ansible-project] Install a french version of SQLServer on an english windows server with ansible

2021-06-24 Thread &#x27;Jean-Yves LENHOF' via Ansible Project

Hi,


I try to silently install a french version of SQLServer (this is not my 
idea, it's become this is the licensed version we have) with ansible 
using some code like this (I already installed MUI French lang pack via 
ansible) :


- name: "Change LANG"
  win_shell: |
Set-WinUILanguageOverride -Language fr-FR

- name: "Silent Install of SQL Server 2019"
  win_shell: |
D:\SETUP.EXE 
/ConfigurationFile=c:\Windows\ansible_SQLSERVER2019_EXPRESS_ConfigurationFile.ini 
/SAPWD=MySuperPassw0rd /IAcceptSQLServerLicenseTerms


But it keeps saying that there's something wrong with my language...

fatal: [myserver]: FAILED! => {
"changed": true,
"cmd": "D:\\SETUP.EXE 
/ConfigurationFile=c:\\Windows\\ansible_SQLSERVER2019_EXPRESS_ConfigurationFile.ini 
/SAPWD=MySuperPassw0rd /IAcceptSQLServerLicenseTerms",

"delta": "0:00:00.531238",
"end": "2021-06-24 04:13:53.809159",
"msg": "non-zero return code",
"rc": 1,
"start": "2021-06-24 04:13:53.277921",
"stderr": "",
"stderr_lines": [],
"stdout": "This SQL Server setup media does not support the language 
of the OS, or does not have the SQL Server English-language version 
installation files.  Use the matching language-specific SQL Server 
media; or install  both the language specific MUI and change the format 
and system locales through the regional settings in the control 
panel.\r\n\r\n\r\n\r\n",

"stdout_lines": [
"This SQL Server setup media does not support the language of 
the OS, or does not have the SQL Server English-language version 
installation files.  Use the matching language-specific SQL Server 
media; or install  both the language specific MUI and change the format 
and system locales through the regional settings in the control panel.",

"",
"",
""
]
}

But If I'm connecting on the server the UI Lang is changed to French (so 
this part seems to work) and if I run the command line on powershell it 
succeed.
On Linux I would have just surcharged LANG parameter before my command 
but on windows, I think this is not possible...


Is there's something on ansible which force the language to english ?
If not, is someone has an idea on what's going on...

Thanks


Regards,

--
Jean-Yves LENHOF
jean-y...@lenhof.eu.org

--
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/1e339d4d29c250b355347bedee222c91%40lenhof.eu.org.


Re: [ansible-project] Reg: VMware Tools install using Ansible

2021-05-19 Thread Jean-Yves LENHOF

Why not using open-vm-tools ?

Regards,

Le 2021-05-19 11:45, harshc...@gmail.com a écrit :

Hello All,

I have a requirement in which I have to install VMware tools on VMs i
created on VSphere, as by default its not present when i am creating a
VM.

Is it possible using ansible or using any other script to install it
on the freshly created VM.

Thanks in advance

Harsh Chawda




--
--
Jean-Yves LENHOF
jean-y...@lenhof.eu.org

--
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/9e69205db837aa785c4bad1fd2283512%40lenhof.eu.org.


Re: [ansible-project] unable to create VM on esxi 7.0

2021-04-05 Thread Jean-Yves LENHOF

Hi,


Please explain which module you are using when asking questions !

So have a guess that you are using this one

https://docs.ansible.com/ansible/2.8/modules/vmware_guest_module.html#vmware-guest-module

So two options :

- ask to update the certificate with a trusted and not expired one

- use "validate_certs" option

Regards,

JYL


Le 05/04/2021 à 19:53, bec12...@gmail.com a écrit :


Okay...thank you. I think now i am having a different error of 
certifiate.


fatal: [localhost -> localhost]: FAILED! => {"changed": false, "msg": 
"Unable to connect to vCenter or ESXi API at vsecurity.com on TCP/443: 
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: 
certificate has expired (_ssl.c:1123)"}


I tried to secure copy the rui.crt from vmware esxi via ssh to the 
ansible control node but it fails all the time.
On Monday, 5 April 2021, 20:16:27 EEST, Dick Visser 
 wrote:



You're connecting to a host called 'vsecurity', but that doesn't 
resolve to something.

At least not on the host you're trying to run the playbook from.

On Mon, 5 Apr 2021 at 14:00, rebecca acheampong > wrote:


I am creating a virtual machine using ansible. I received this
error and do not know how to solve it. I am new student to both
VMware and asnible. This is the error i received:

fatal: [localhost -> localhost]: FAILED! => {"changed": false,
"msg": "Unknown error while connecting to vCenter or ESXi API at
vsecurity:443 : [Errno -3] Temporary failure in name resolution"}

Pleae your help is appreciated. I do not use a vcenter
-- 
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/42014b84-ba5a-4f65-afa0-4291a393c96an%40googlegroups.com

.

--
Sent from a mobile device - please excuse the brevity, spelling and 
punctuation.

--
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/CAL8fbwN8hUp%3DnRAZ7dTRaP_FOWejO5-3Fv96WCrWogRtFpgNMg%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/1434076522.6073543.1617645236935%40mail.yahoo.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/2d820ea6-9319-064b-7d72-226c709d31c3%40lenhof.eu.org.


Re: [ansible-project] Am I missing something or Ansible is uselessly verbose?

2021-03-01 Thread Jean-Yves LENHOF
"user" is the name of a module ! (since 2.10 it is now ansible.builtin.user but 
for now there's some backward compatibility) 
You can alternate part of your playbook with some being root or another user 
and some with the remote_user. So these different tag are needed, but you can 
factorize them on the play level or put them in the config file if you want 

⁣Télécharger BlueMail pour Android ​

Le 2 mars 2021 à 01:25, à 01:25, Istvan Kis  a écrit:
>I am just starting to learn Ansible as I need it for my current job.
>I am kind of disappointed.
>Why can't: 
>
>*become: yesbecome_user: root*
>Just be:
>*user: root*
>Can you become anything else other than a user?
>
>-- 
>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/90c7917a-0804-4332-8b92-fd76a296257en%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/2b32bd86-f8b4-4106-86c3-7b541ca92f3d%40lenhof.eu.org.


Re: [ansible-project] Re: Ansible Without Python?

2021-02-24 Thread Jean-Yves LENHOF



Le 24/02/2021 à 22:18, Jon Forrest a écrit :

On 2/24/2021 12:42 PM, Sam Doran wrote:
Jimi actually did this a while ago  
to see if there were any benefits.


I wasn't aware of this. Thanks for the reference.

In the end, there was no real benefit to moving to Go since most of 
the time the control node is waiting for code to execute and return 
results from the managed nodes.


I'd like to learn how complicated the playbooks and host files were that
he used for the experiment. As I said, in small environments I wouldn't
expect much of an improvement. But, I once worked at a place that had
~1,000 hosts and a very complicated group structure where I think a
compiled language would have made a difference on the controller.



First things to try are :

- Playing with the number of forks on the ansible config 
(https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html#setting-the-number-of-forks)



Another way to speed up but with some CAVEATS is to use some material of 
mitogen


https://mitogen.networkgenomics.com/ansible_detailed.html


Regards,

JYL

--
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/4d78571a-a601-5495-704f-33113c509873%40lenhof.eu.org.


Re: [ansible-project] Ansible Without Python?

2021-02-24 Thread Jean-Yves LENHOF


Le 24/02/2021 à 21:21, Wei-Yen Tan a écrit :
Well on the client side you can run any language. Ansible uses the 
shebang on the task module to execute the script. I have even written 
a custom module that runs powershell on a linux client. You could run 
bash. As long as you output json object  ansible will just execute and 
return it back.


Good luck on porting all the module python code with shell code...

The idea is using a script and not a compiled program is to have not to 
install something on the client side... If you want a binary on the 
client side, you're just doing another sort of puppet like language with 
a necessary client !


The main target of ansible is linux and python is a prerequirements to 
follow the LSB standard, so it is always installed on any linux !


Regards,

JYL


--
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/63fb6c9a-d42d-0eec-10bc-099899f378fc%40lenhof.eu.org.


Re: [ansible-project] Ansible Without Python?

2021-02-24 Thread Jean-Yves LENHOF

Hi,

There's part of the code that run on the controller, but also on the client.

Today you can run the same ansible code on unix and linux server because 
the python binary is the one used on the client side, if using a 
compiled language you need to have all the binary version of all your 
potentials clients os.


Regards,

JYL

Le 24/02/2021 à 20:33, Jon Forrest a écrit :

I had a radical thought the other day. Would it be possible to
replace Python as the language used by Ansible with a compiled language,
perhaps Go because of its fast compile and link speed? Note that I'm not
talking about something like the existing Ansible shell module, which is
only useful in environments without Python (or Go).

This is actually two questions because the answer depends on
whether we're talking about the controller or the client.
On the controller it would be a simple matter of software
to rewrite Ansible to produce the same Python it produces
today. I suspect, but have no data to support, that an Ansible
controller would run much faster this way, especially in large
environments.

Go Ansible on the client would be much harder and I think is less
likely to produce positive results. Obviously each client
would have to have a working Go environment. I suspect that
it would be no more difficult to make this happen than it is
to put a working Python environment on a client.

At first glance it isn't clear that the size of such an environment
would be smaller in Go than in Python. Indeed, the size of the Go 1.16
installer for Windows is roughly 100MB larger than that for
Python 3.9.2. However, if this is an issue I suspect that a striped down
working Go environment could be created that's much smaller.

Another step necessary on the client would be the creation of
a pre-compiled Go Ansible runtime. With this present on each
client, the Ansible controller would only have to send the
minimal amount of Go code to the client, which would then compile
that code, and link it with the Go Ansible runtime. It's only
because Go has such an incredibly fast compiler and linker that
Go Ansible is worth considering.

I suspect, but again can't prove, that various clever caching techniques
could be using on the client to reduce the amount of compiling
and linking that needs to be done.

For simple small environments what I'm thinking about wouldn't make much
difference. However, there are some huge Ansible environments out there
that I could see benefiting from what I have in mind.

Thoughts?

Cordially,
Jon Forrest







--
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/bdcd2006-79e7-9155-8007-2678dd3166fd%40lenhof.eu.org.


Re: [ansible-project] inventory inside play

2021-02-18 Thread Jean-Yves LENHOF

Hi,

Another way of doing...

You can also change the inventory live with some modules

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/group_by_module.html#ansible-collections-ansible-builtin-group-by-module

Regards,

JYL


Le 18/02/2021 à 19:45, j..r.. a écrit :
I'm trying to deploy vms from template on esx with vmware_guest module 
and this work great, but I would like to do inside this playbook some 
modification on vm after deployment. My inventory file is being 
populated with the same playbook with hosts that are being deployed, 
but after that I'm doing some modification, problem is that this hosts 
are being skipped because ansible doesn't know for this hosts, setup 
module doesn't do the job. How would I convinced ansible to reread 
inventory file?


Hear is last part of the playbook:

   - name: add to inventoryfile
 lineinfile:
   dest: /home/ansible/vmware/inventory
   line: '{{ item.vm_name }}'
 loop: '{{ vm }}'
 delegate_to: localhost

   - setup:

    - name: Read device information
 community.general.parted: device=/dev/sda unit=MiB
 register: sda_info
 when: inventory_hostname in groups.deploy

   - name: Extend an existing partition to fill all available space
 community.general.parted:
   device: /dev/sda
   number: "{{ sda_info.partitions | length }}"
   part_end: "100%"
   resize: true
   state: present
 when: inventory_hostname in groups.deploy

   - name: pv resize
 community.general.lvg:
   vg: vg_root
        pvs: /dev/sda2
   pvresize: yes
 when: inventory_hostname in groups.deploy

   - name: fqdn
 hostname:
   name: "{{ ansible_fqdn }}"
 when: inventory_hostname in groups.deploy


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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d582-ea28-447f-b252-09c10c1af7e0n%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/cb0301e8-2750-bf66-13d4-021a7ca93083%40lenhof.eu.org.


Re: [ansible-project] Re: GCP Tunnel through IAP

2021-02-09 Thread Jean-Yves LENHOF

Hi,

Just gave some directions in the issue on github to make it work

Regards,

JYL


Le 09/02/2021 à 17:00, C.J. Brown a écrit :
Say, did you ever find a better solution here?  Because I've run into 
the same problem recently, and...well, it's ugly.


I saw that this ticket had been filed against Ansible:

https://github.com/ansible/ansible/issues/66310

...but was auto-closed by ansibot when all this stuff got moved to the 
GCP collection.  So I've filed my own feature request against that repo:


https://github.com/ansible-collections/google.cloud/issues/373

We'll see if anybody picks it up over there.  My sense is that a 
number of folks have had the Ansible-over-IAP problem; one of these 
days, GCP really ought to support a proper solution...


On Monday, November 25, 2019 at 12:16:11 PM UTC-6 race...@gmail.com wrote:

I am required to tunnel through IAP with service account credentials.

I have overridden my ssh binary, ‘ssh_executable=script.sh’,
creating a ‘gcloud compute ssh  —tunnel-through-iap’ wrapper,
where I regex ssh arguments into the gcloud command.

For tunneling to work I must
1. Run my playbook with my instance IP in the hosts variable of my
playbook
2. Hardcode my compute instance hostname for my ssh wrapper
connection.
3. This always makes an initial connection but always fails to run
the command. No matter my regex there is always extra “, ‘ or
something.
4. Comment out my ‘ssh_execution’ wrapper overriding in ansible.cfg
5. Run my playbook again which runs successfully.


Running the playbook with the gcp plugin will only list available
instances but will never ssh successfully without a previously
opened gcloud session.


--
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/49aa114a-ef11-428b-a6e5-3c8dbd672ce5n%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/15ee75c3-6f64-2c18-4e7f-fc0b80a461f7%40lenhof.eu.org.


Re: [ansible-project] Re: module stderr

2021-01-26 Thread Jean-Yves LENHOF
Probably you are not using the same ansible version locally and under awx

⁣Télécharger BlueMail pour Android ​

Le 26 janv. 2021 à 21:39, à 21:39, "kevin.mu...@gmail.com" 
 a écrit:
>Managed to fix the issue.
>
>within the block of code under Edit omsagent.conf, I was using the
>template 
>module and specified it as:
>
>ansible.builtin.template: 
>
>This works fine when it is ran locally on the machine but for some
>reason 
>AWX doesnt seem to like that so instead I changed it to:
>
>template:
>
>Hope this helps anyone that does come across this issue. Thanks.
>On Tuesday, January 26, 2021 at 7:20:01 PM UTC kevin.mu...@gmail.com
>wrote:
>
>> Hello,
>>
>> I am getting this issue when launching the template from AWX.
>>
>> I have been trying to figure it out for a while but got stuck and was
>
>> hoping anyone could assist please?
>>
>> Please see the attached screenshot of the error.
>> many thanks.[image: Capture.PNG]
>>
>
>-- 
>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/0de34d97-dd0a-4d69-8609-a9feea03a2b3n%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/14f40f6f-803f-4517-bcb3-c8653556e93f%40lenhof.eu.org.


Re: [ansible-project] Ansible Organization - When to split out projects

2021-01-25 Thread Jean-Yves LENHOF



Le 25/01/2021 à 16:03, John Petro a écrit :

Good morning,
   I am working on setting up an ansible repository, for work.  We are 
going to be using AWX eventually ( sooner rather than later ).  What I 
am wondering, is how people decided to split up their ansible project 
directories. My first thought was to just have a single project with 
all of our playbooks in that but I am starting to question whether 
that is the correct path or not.


Not so obvious to answer !




Along with that, when it comes to source control, are you storing your 
roles in a separate repo per role, or all in one repo.  For myself 
personally ( homelab ), I have a single project, and all of my roles 
have their own repo, but I am not sure how that scales to a larger 
organization.


One role per repo with version tags !

Like this you can use version in your requirements file and decide which 
version is working for you in your context. Periodically you need to 
update versions and make some adjustments to code after testings !


The more a role is going to be used by different people, the more you 
will need a concensus about changes and decide what change can be done 
in in a minor and in a major release version !


Regards,

JYL

--
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/b8e10d84-4a41-dc3c-52c8-99433327c2a6%40lenhof.eu.org.


Re: [ansible-project] how to get the host in groups children?

2021-01-20 Thread Jean-Yves LENHOF

Hi,

1/

Sounds like you use a lot the when clause to limit the impact of action 
to some servers.


Why you did'nt use more the hosts clause to handle the action on 
specific hosts ?


You can have more than one hosts clause in a playbook

Notice that you can reuse variable in a previous play in another play also.


2/

What do you want to achieve really ?


3/

Sounds weird to have three master and only one worker in a kubernetes 
cluster... The other way around is more "common"


Regards,

JYL


Le 21/01/2021 à 07:18, liyo...@126.com a écrit :

my inventroy file is below:
[master]
172.24.64.44
172.24.64.42
172.24.64.43
[worker]
172.24.64.46

[cluster:children]
master
worker

I want to exec the playbook in [cluster:children]'s master 
172.24.64.44,want to get the variables value ,then use it in other 
group ,how to write the "when" ? please help me ?



my playbook is :
- name: Get master token
  shell: kubeadm token list |grep forever|awk '{print $1}'
  register: kubeadm_token
  when: inventory_hostname == groups['cluster:children']['master']|first

- name: Get master hash
  shell: "openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin 
-outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^ .* //'|cut -d' ' -f2"
  register: kubeadm_hash
when: xx

- name: Add master node
  shell:
cmd: kubeadm join  {{ groups['master'][0] }}:6443 --token {{ 
hostvars[groups['cluster']['master']|first]['kubeadm_token'].stdout }}  
--discovery-token-ca-cert-hash sha256:{{ 
hostvars[groups['master']|first]['kubeadm_hash'].stdout }}
  when:
- inventory_hostname in groups['worker']


I want to get the token and hash value,then use it in "worker" groups

--
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/7797386d-3d83-4a94-98e0-be9ccc47c69dn%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/a57b1200-4159-a2fa-984a-984df415114f%40lenhof.eu.org.


Re: [ansible-project] register variable can't be used in shell module?

2021-01-20 Thread Jean-Yves LENHOF

You could try something

hostvars[groups['master']|first] instead of hostvars['master'] in my 
proposition to see it that works...not sure


Use a debug module could help

Regards,

JYL


Le 20/01/2021 à 08:53, liyo...@126.com a écrit :
yes,I want only get one host in member of group ‘master’,how  to write 
it ?

[root@localhost ~]# cat /etc/ansible/hosts
[master]
47.108.222.84
47.108.234.26
47.108.213.148

only use "47.108.222.84" to do shell command

在2021年1月20日星期三 UTC+8 下午3:47:31 写道:

I'm wrong it's not hostvars['master'], because master is not
the name of your first host in group master


Le 20/01/2021 à 08:33, Jean-Yves LENHOF a écrit :

You're looking for something like this I think (not tested)  :

    - name: add master node
      shell: "kubeadm join {{ groups['master']|first }}:6443
--token {{hostvars['master']['kubeadm_token'].stdout}}
--discovery-token-ca-cert-hash
sha256:{{hostvars['master']['kubeadm_hash'].stdout}} --control-plane"
      when: inventory_hostname != groups['master']|first

Please be careful using special hostvars variable, there's no
control in this array if the variable exist, etc... so use with
caution

Regards,

JYL

Le 20/01/2021 à 08:17, liyo...@126.com a écrit :

I know,but I want get the token in A host,use it in other
hosts,how to do it ?

在2021年1月20日星期三 UTC+8 下午2:31:36 写道:

Hii

You're registering a variable for one host (47.108.222.84)
but then try to use it for another (47.108.213.148).

I'm have no experience with kubeadm but I think your logic
wrt host selection should be improved, so that you can
reliably pick the variable from a stable group name, instead
of "the last item".


On Wed, 20 Jan 2021 at 05:26, liyo...@126.com
 wrote:

when I edit a playbook test.yml:

---
- hosts: master
  gather_facts: no
  tasks:
    - name: register hash
      shell: "openssl x509 -pubkey -in
/etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform
der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^
.* //'|cut -d' ' -f 2"
      register: kubeadm_hash
      when: inventory_hostname == groups['master']|first

    - name: display hash
      debug: msg="{{kubeadm_hash.stdout}}"
      when: inventory_hostname == groups['master']|first

    - name: register token
      shell: kubeadm token list |grep forever|awk
'{print $1}'
      register: kubeadm_token
      when: inventory_hostname == groups['master']|first
    - name: display token
      debug: msg="{{kubeadm_token.stdout}}"
      when: inventory_hostname == groups['master']|first
    - name: add master node
      shell: "kubeadm join {{ groups['master'][0]
}}:6443 --token {{kubeadm_token.stdout}}
--discovery-token-ca-cert-hash
sha256:{{kubeadm_hash.stdout}} --control-plane"
      when: inventory_hostname != groups['master']|first


the results is below:
PLAY [master]

***

TASK [register hash]


skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display hash]

*
ok: [47.108.222.84] => {
    "msg":
"af040f8e06e320e264a79f62b677b3267f4b681d869408658bdd121fa568216c"
}
skipping: [47.108.213.148]
skipping: [47.108.234.26]

TASK [register token]

***
skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display token]

**

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Jean-Yves LENHOF
I'm wrong it's not hostvars['master'], because master is not the 
name of your first host in group master



Le 20/01/2021 à 08:33, Jean-Yves LENHOF a écrit :

You're looking for something like this I think (not tested) :

    - name: add master node
      shell: "kubeadm join {{ groups['master']|first }}:6443 --token 
{{hostvars['master']['kubeadm_token'].stdout}} 
--discovery-token-ca-cert-hash 
sha256:{{hostvars['master']['kubeadm_hash'].stdout}} --control-plane"

      when: inventory_hostname != groups['master']|first

Please be careful using special hostvars variable, there's no control 
in this array if the variable exist, etc... so use with caution


Regards,

JYL

Le 20/01/2021 à 08:17, liyo...@126.com a écrit :
I know,but I want get the token in A host,use it in other hosts,how 
to do it ?


在2021年1月20日星期三 UTC+8 下午2:31:36 写道:

Hii

You're registering a variable for one host (47.108.222.84) but
then try to use it for another (47.108.213.148).

I'm have no experience with kubeadm but I think your logic wrt
host selection should be improved, so that you can reliably pick
the variable from a stable group name, instead of "the last item".


On Wed, 20 Jan 2021 at 05:26, liyo...@126.com 
wrote:

when I edit a playbook test.yml:

---
- hosts: master
  gather_facts: no
  tasks:
    - name: register hash
      shell: "openssl x509 -pubkey -in
/etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der
2>/dev/null | openssl dgst -sha256 -hex | sed 's/^ .* //'|cut
-d' ' -f 2"
      register: kubeadm_hash
      when: inventory_hostname == groups['master']|first

    - name: display hash
      debug: msg="{{kubeadm_hash.stdout}}"
      when: inventory_hostname == groups['master']|first

    - name: register token
      shell: kubeadm token list |grep forever|awk '{print $1}'
      register: kubeadm_token
      when: inventory_hostname == groups['master']|first
    - name: display token
      debug: msg="{{kubeadm_token.stdout}}"
      when: inventory_hostname == groups['master']|first
    - name: add master node
      shell: "kubeadm join {{ groups['master'][0] }}:6443
--token {{kubeadm_token.stdout}}
--discovery-token-ca-cert-hash
sha256:{{kubeadm_hash.stdout}}  --control-plane"
      when: inventory_hostname != groups['master']|first


the results is below:
PLAY [master]

***

TASK [register hash]


skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display hash]

*
ok: [47.108.222.84] => {
    "msg":
"af040f8e06e320e264a79f62b677b3267f4b681d869408658bdd121fa568216c"
}
skipping: [47.108.213.148]
skipping: [47.108.234.26]

TASK [register token]

***
skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display token]


ok: [47.108.222.84] => {
    "msg": "otnb1h.cvagwwe7tgdvzbtx"
}
skipping: [47.108.234.26]
skipping: [47.108.213.148]

TASK [add master node]

**
skipping: [47.108.222.84]
fatal: [47.108.234.26]: 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/test.yml': line 23, column 7, but may\nbe elsewhere
in the file depending on the exact syntax proble

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Jean-Yves LENHOF

You're looking for something like this I think (not tested)  :

    - name: add master node
      shell: "kubeadm join {{ groups['master']|first }}:6443 --token 
{{hostvars['master']['kubeadm_token'].stdout}} 
--discovery-token-ca-cert-hash 
sha256:{{hostvars['master']['kubeadm_hash'].stdout}} --control-plane"

      when: inventory_hostname != groups['master']|first

Please be careful using special hostvars variable, there's no control in 
this array if the variable exist, etc... so use with caution


Regards,

JYL

Le 20/01/2021 à 08:17, liyo...@126.com a écrit :
I know,but I want get the token in A host,use it in other hosts,how to 
do it ?


在2021年1月20日星期三 UTC+8 下午2:31:36 写道:

Hii

You're registering a variable for one host (47.108.222.84) but
then try to use it for another (47.108.213.148).

I'm have no experience with kubeadm but I think your logic wrt
host selection should be improved, so that you can reliably pick
the variable from a stable group name, instead of "the last item".


On Wed, 20 Jan 2021 at 05:26, liyo...@126.com  wrote:

when I edit a playbook test.yml:

---
- hosts: master
  gather_facts: no
  tasks:
    - name: register hash
      shell: "openssl x509 -pubkey -in
/etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der
2>/dev/null | openssl dgst -sha256 -hex | sed 's/^ .* //'|cut
-d' ' -f 2"
      register: kubeadm_hash
      when: inventory_hostname == groups['master']|first

    - name: display hash
      debug: msg="{{kubeadm_hash.stdout}}"
      when: inventory_hostname == groups['master']|first

    - name: register token
      shell: kubeadm token list |grep forever|awk '{print $1}'
      register: kubeadm_token
      when: inventory_hostname == groups['master']|first
    - name: display token
      debug: msg="{{kubeadm_token.stdout}}"
      when: inventory_hostname == groups['master']|first
    - name: add master node
      shell: "kubeadm join {{ groups['master'][0] }}:6443
--token {{kubeadm_token.stdout}}
--discovery-token-ca-cert-hash sha256:{{kubeadm_hash.stdout}} 
--control-plane"
      when: inventory_hostname != groups['master']|first


the results is below:
PLAY [master]

***

TASK [register hash]


skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display hash]

*
ok: [47.108.222.84] => {
    "msg":
"af040f8e06e320e264a79f62b677b3267f4b681d869408658bdd121fa568216c"
}
skipping: [47.108.213.148]
skipping: [47.108.234.26]

TASK [register token]

***
skipping: [47.108.234.26]
skipping: [47.108.213.148]
changed: [47.108.222.84]

TASK [display token]


ok: [47.108.222.84] => {
    "msg": "otnb1h.cvagwwe7tgdvzbtx"
}
skipping: [47.108.234.26]
skipping: [47.108.213.148]

TASK [add master node]

**
skipping: [47.108.222.84]
fatal: [47.108.234.26]: 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/test.yml': line 23, 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: add master
node\n      ^ here\n"}
fatal: [47.108.213.148]: 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/test.yml': line 23, 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: add master
 

Re: [ansible-project] Ansible --become not working when “sudo with NOPASSWD” is not activated on remote machine - MODULE FAILURE

2021-01-15 Thread Jean-Yves LENHOF

Hi,

Sounds strange indeed.

Please try to connect to remote server with ssh with remote_user, and do 
a "sudo ls /" for example to see if the problem occurs


You did authorize all commands for sudo and not only "sudo su -"? 
(something like this below)


%sudo    ALL=(ALL:ALL) ALL

Regards,

JYL


Le 15/01/2021 à 09:55, Mohit Dhingra a écrit :


Hi,

In remote server, normal user is having sudo access but NOPASSWD not 
activated. sudo su - command ask for user password. I am trying to run 
a command using Ansible as providing sudo password but its not working 
getting "MODULE FAILURE\nSee stdout/stderr for the exact error" error. 
Please check below logs.


Inventory file
___
[root@**-*2 ~]# cat inventory
[prod]
10.***.***.250 ansible_user=m ansible_password=***
___

Its working with normal user

___
[root@** ~]# ansible prod -m ping
10.***.***.250 | SUCCESS => {
    "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}
___

But when i switch to become
___
[root@** ~]# ansible prod -m ping --become
10.***.***.250 | FAILED! => {
    "msg": "Missing sudo password"
}
___

when i provide Sudo Password.

___
[root@** ~]# ansible prod -m ping --become -K
BECOME password:
10.***.***.250 | FAILED! => {
    "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "Shared connection to 10.***.***.250 closed.\r\n",
    "module_stdout": "\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
___


the verbose output of above error is

___
10.***.***.250 | FAILED! => {
    "ansible_facts": {
    "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 
2017\r\ndebug1: Reading configuration data 
/etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying 
options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: 
fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master 
version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 
local, 0 remote\r\ndebug3: mux_client_request_session: 
entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: 
mux_client_request_alive: done pid = 21356\r\ndebug3: 
mux_client_request_session: session request sent\r\ndebug1: 
mux_client_request_session: master session id: 2\r\ndebug3: 
mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: 
Received exit status from master 1\r\nShared connection to 
10.***.***.250 closed.\r\n",

    "module_stdout": "\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}
___


It is working where sudo with NOPASSWD activated. Kindly suggest.

--
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/4d71cdd1-5849-4bdd-a055-1499ebb6a6ean%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/3a97d30a-c8b9-e4bf-f179-31620d3a6540%40lenhof.eu.org.


Re: [ansible-project] SQL Server Dynamic Database Creation using Ansible

2021-01-15 Thread Jean-Yves LENHOF
All good editors (you could to install some plugins) have syntax and 
quoting coloring enabled


vim and visual studio code are some examples, but there are quite a few

https://docs.ansible.com/ansible/latest/community/other_tools_and_programs.html

The documentation of ansible is quite good, so again, you should read it !

Regards,

JYL


Le 15/01/2021 à 05:48, 'Praveen Kumar Singh' via Ansible Project a écrit :

Is there any tool or way I can find where I am putting the quotes wrong?

Thanks and Regards
Praveen Singh


--
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/95e6d5be-17f5-8c95-4477-8e2ccd66799c%40lenhof.eu.org.


Re: [ansible-project] help while running sudo in Ansible playbooks

2021-01-15 Thread Jean-Yves LENHOF


Le 15/01/2021 à 06:08, Ramakrishna Veeragandham a écrit :


Hi Ansible team,

I am Ram.  We need some help in running the Ansible playbook ( 
specifically how to add sudo while running playbooks ).  in your 
environment, we can run all admin related commands with sudo acess (  
by adding sudo in front of command . For example, sudo vgs or sudo vi 
/etc/sudoers ). We don't have root access and hence we don't wanted to 
run the playbooks with direct root access .


Most of our servers ( Redhat / Solaris / Aix ) doesn't have root 
access. The possibility of running all admin activities are by running 
sudo   as admin ( sysunx ) user.



Hi,

Ansible is designed to have all sudo (or su) access (but not remote root 
acess to be more specific)So you should be sure thats is no way to 
have it !


See "Privilege escalation must be general 
" on 
https://docs.ansible.com/ansible/latest/user_guide/become.html#only-one-method-may-be-enabled-per-host


If not, you can still use the same command you already use with "sudo 
command" with the shell module (using become: no)... but's ugly and you 
loose idempotence work of all the module (except shell) that are 
provided by ansible community



Regards,

JYL

--
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/051e75c1-24ef-6722-a4aa-aaa13fc28b60%40lenhof.eu.org.


Re: [ansible-project] SQL Server Dynamic Database Creation using Ansible

2021-01-14 Thread Jean-Yves LENHOF

Hi,

Read docs a little !

https://docs.ansible.com/ansible/latest/user_guide/playbooks_prompts.html

DbName is the variable, so that should be the name

DB Config is the prompt written on the the screen, so that should be the 
prompt


try changing like this in your code :

   vars_prompt:
     - name: DbName
       private: no
       prompt: DB Config
       default:


You should probably have to make some verification of what you write, 
because if you just press enter the variable will be '', so I suppose 
your code will fail



Regards,

JYL


Le 14/01/2021 à 16:01, 'Praveen Kumar Singh' via Ansible Project a écrit :

Thanks Dick,

I tried jinja syntax and now am getting below error. The variable 
DbName is already declared and still getting the below error. So can 
you please suggest.


fatal: [SQLSERVER2]: FAILED! => {"msg": "The task includes an option 
with an undefined variable. The error was: 'DbName' is 
undefined\n\nThe error appears to be in 
'/local/cfjenkins/Ansible_Test_Project/DBconfig.yml': line 9, column 
8, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n   tasks:\n     - 
name: DB config\n       ^ here\n"}


---
 - hosts: SQLSERVER2
   vars_prompt:
     - name: DB Config
       private: no
       prompt: DbName
       default:
   tasks:
     - name: DB config
       vars:
        DbName:
       win_shell: |
          $sql = "DECLARE @Query VARCHAR(MAX)=''
                  DECLARE "{{ DbName }}" VARCHAR(400) = ''
                  DECLARE @DbFilePath VARCHAR(400) = 'E:\Database\'
                  SET @Query = @Query + 'CREATE DATABASE '+"{{ DbName 
}}" +' ON  PRIMARY '
                  SET @Query = @Query + '( NAME = '''+"{{ DbName }}" 
+''', FILENAME = '''+@DbFilePath+@DbName +'.mdf'' , SIZE = 3072KB , 
MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) '

                  SET @Query = @Query + ' LOG ON '
                  SET @Query = @Query + '( NAME = '''+"{{ DbName }}" 
+'_log'', FILENAME = '''+@DbFilePath+@DbName +'_log.ldf'' , SIZE = 
1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)'

                  print @query
                  exec(@query)"
                  Invoke-SqlCmd -Query $sql

Thanks and regards,
Praveen Singh


On Thu, Jan 14, 2021 at 5:42 AM Dick Visser > wrote:


On Thu, 14 Jan 2021 at 14:28, 'Praveen Kumar Singh' via Ansible
Project mailto:ansible-project@googlegroups.com>> wrote:
>
> Hello All,
>
> I am trying to create a new database on sql server using the
below mentioned ansible playbook.
>
> But when I am executing the playbook and in the prompt option
putting the database name.
>
> It is not taking that database name of the prompt and instead
creating the database mentioned in the SQL query (in this case
creating database TestDB).

That is what you tell it to do, so this is expected behavior.



> So needed help in how I can create the database dynamically by
putting the Database name in the prompt option.
>
> ---
>  - hosts: SQLSERVER
>    vars_prompt:
>      - name: DB Config
>        prompt: DbName
>        default:
>    tasks:
>      - name: DB config
>        win_shell: |
>           $sql = "DECLARE @Query VARCHAR(MAX)=''
>                   DECLARE @DbName VARCHAR(400) = 'TestDB'

This is where you declare the var in windows language (or whatever you
call that).

>                   DECLARE @DbFilePath VARCHAR(400) = 'E:\Database\'
>                   SET @Query = @Query + 'CREATE DATABASE
'+@DbName +' ON  PRIMARY '
>                   SET @Query = @Query + '( NAME = '''+@DbName
+''', FILENAME = '''+@DbFilePath+@DbName +'.mdf'' , SIZE = 3072KB
, MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) '
>                   SET @Query = @Query + ' LOG ON '
>                   SET @Query = @Query + '( NAME = '''+@DbName
+'_log'', FILENAME = '''+@DbFilePath+@DbName +'_log.ldf'' , SIZE =
1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)'
>                   print @query
>                   exec(@query)"
>                   Invoke-SqlCmd -Query $sql

Try jinja syntax, ie.

{{ DbName }}

instead of

@DbName




-- 
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/CAL8fbwN%3D9gvs5OsPtmZby%3DU_iLHhnK-9EOdv0A-LwThyR7K7ig%40mail.gmail.com



Re: [ansible-project] Options in Mount module for fstab

2021-01-13 Thread Jean-Yves LENHOF

Hi,

For xfs file system, fsck is not necessary.

For the record on the man page of fsck.xfs "fsck.xfs - do nothing, 
successfully"


On rare occasion you could need xfs_repair !

Regards,

JYL


Le 13/01/2021 à 22:28, Matt Martz a écrit :

Those are the `dump` and `passno` arguments for the module.

On Wed, Jan 13, 2021 at 3:26 PM 1793...@gmail.com 
 <1793j...@gmail.com 
> wrote:



Hello there,

I have the following task:

- name: Mount /dev/testvg/testlv
mount:
path: /test
src: /dev/testvg/testlv
fstype: xfs
opts: defaults
state: present

I'm using the mount module. I'm trying to achieve inserting the
following line into fstab:

/dev/testvg/testlv /test xfs defaults 1 2

However, when running the playbook, I get the following result:

/dev/testvg/testlv /test xfs defaults 0 0

How can I set 1 2 instead of 0 0 with the mount module?

Regards,

Josue.
-- 
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/44080506-2213-48ef-8f7a-d9b0ff18bdbcn%40googlegroups.com

.



--
Matt Martz
@sivel
sivel.net 
--
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/CAD8N0v_RnzFkf-YozE7sB7e59uY3%2BDeK8fJjc6v%3DcVe7eNuuyw%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/d7599af6-cb06-06ed-c410-a6e00f4d7e16%40lenhof.eu.org.


Re: [ansible-project] How are group_vars merged?

2021-01-07 Thread Jean-Yves LENHOF

Hi,

Perhaps here is what you're looking for...

https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#how-variables-are-merged

There's a parameter available to change the default behaviour

Regards,

JYL


Le 07/01/2021 à 18:25, Axel Rau a écrit :

Hi all,

I try to understand how group_vars are merged:

 From my inventory/hosts:

all:
   children:

 ...
 dmz5_jails:
   hosts:
 ...
 ns5:
 ...

 ...
 dmz5_hosts:
   children:
 ...
 dmz5_jails:

 all_jails:
   children:
 ...
 dmz5_jails:

 ns:
   hosts:
 ns5:

 From my inventory/group_vars/ns.yaml:

lr_ns_public_zones: [
...
]

A playbook:

---

- hosts: ns
   gather_facts: false

   roles:
   - roles/lr_bind9

 From roles/lr_bind9/defaults/main.yaml:

...

# private and public zones
lr_bind9_private_zones: []


 From roles/lr_bind9/tasks/main.yaml:

...

- debug:
 msg: "group_vars[ns] {{ lr_bind9_private_zones }}"


Running the playbook, prints this debug message:

TASK [roles/lr_bind9 : debug] 
ok: [ns5] => {
 "msg": "group_vars[ns] []"
}

If I omit the default entry, it shows up as undefined:

fatal: [ns5]: FAILED! => {"msg": "The task includes an option with an undefined 
variable. The error was: ‚lr_bind9_private_zones'


What am I doing wrong?

Axel
---
PGP-Key: CDE74120  ☀  computing @ chaos claudius



--
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/b1921323-5a8b-570c-9df2-c98e96c2d71c%40lenhof.eu.org.


Re: [ansible-project] CentOS 7 is end-of-life when using Ansible?

2020-12-17 Thread Jean-Yves LENHOF

Hi,

Statement here could interest you :

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

Regards,


Le 17/12/2020 à 08:57, Onno a écrit :

Hi all,
I stumbled onto the problem
If you require Python 3 support use the `dnf` Ansible module instead."

This message baffles me. It has for some time and I do not understand 
what it implies or means.


My conclusion at this point is that CentOS 7 should be considered 
end-of-life when using Ansible.  I'm very much interested in opinions 
on this matter.


CentOS 7 has Python 2.7.x and Python 2.7.x is EOF jan 2021.

Now of course you can install Python 3 etc but then you there is that 
message:

If you require Python 3 support use the `dnf` Ansible module instead."

Most Ansible automation for example on Ansible Galaxy uses the package 
module. This package module is deprecated for Python 3.


Everywhere package is used, Ansible will barf up that message. On 
CentOS 7.


You can install dnf etc on CentOS 7, remove yum but this won't help.  
The message remains.


Is my understanding correct that CentOS 7 is EOF jan 2020 if you want 
Python3? Python3 implies CentOS 8 or higher?



--
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/6567265e-c761-4cc7-ac59-2341d0030d61n%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/9eeb47f3-c014-ff78-ef8c-045dbba12781%40lenhof.eu.org.


Re: [ansible-project] Re: Creating LVG's and LVs in Azure

2020-12-11 Thread Jean-Yves LENHOF

Hi,

The message is pretty clear, you have no u01 variable defined in you 
vars file !


So when the line ' when: u01.vg !="None"' evaluate it crashed because 
u01 is not known...


Don't know exactly what you want to do, but I saw ASM, so think about 
Oracle Not sure mixing asm disk and LVM is a very good idea


Regards,

JYL


Le 11/12/2020 à 22:35, David McPherson a écrit :

I get the following error when attempting to create the U01 vg.

FAILED! => {"msg": "The task includes an option with an undefined 
variable. The error was: 'u01' is undefined\n\nThe error appears to be 
in '/etc/ansible/playbooks/configure_disk-dave.yml': line 25, column 
5, but may\nbe elsewhere in the file depending on the exact syntax 
problem.\n\nThe offending line appears to be:\n\n\n  - name: \"Make 
U01\"\n    ^ here\n"}

On Friday, December 11, 2020 at 2:28:30 PM UTC-7 David McPherson wrote:

I have a post install script to partition and then add disk to
Volume groups then create volumes in Azure.  The parted portion of
the script works fine but I get an error attempting to create the
volume groups.  Any help would be appreciated.

Thanks,

Dave


  - name: Partition disk
    parted:
      device: "/dev/disk/azure/scsi1/lun{{ item.lun }}"
      name: 1
      number: 1
      label: gpt
      state: present
    with_items:
      - "{{ extra_disks }}"
    when: item.lun is defined

  - name: "Make U01"
    lvg:
      pvs: "/dev/disk/azure/scsi1/lun{{ u01.lun }}-part1"
      vg: "vg_{{ u01.vg  }}"
    when: u01.vg  != "None"

  - name: Make backups logical volume group
    lvg:
      pvs: "/dev/disk/azure/scsi1/lun{{ backups.lun }}-part1"
      vg: "vg_{{ backups.vg  }}"
    when: backups.vg  != "None"


The disk definition file looks like this:
extra_disks:
  - { size: 512, type: Premium_LRS, lun: 0, name: u01 }
  - { size: 8192, type: Premium_LRS, lun: 1, name: backups }
  - { size: 1024, type: Premium_LRS, lun: 2, name: ASMSR1PRDA }
  - { size: 1024, type: Premium_LRS, lun: 3, name: ASMSR1PRDB }
  - { size: 1024, type: Premium_LRS, lun: 4, name: ASMSR1PRDC }
  - { size: 1024, type: Premium_LRS, lun: 5, name: ASMSR1PRDD }
  - { size: 1024, type: Premium_LRS, lun: 6, name: ASMSR1PRDE }
  - { size: 1024, type: Premium_LRS, lun: 7, name: ASMSR1PRDF }
  - { size: 1024, type: Premium_LRS, lun: 8, name: ASMSR1PRDG }
  - { size: 1024, type: Premium_LRS, lun: 9, name: ASMSR1PRDH }
  - { size: 1024, type: Premium_LRS, lun: 10, name: ASMSR1PRDI }
  - { size: 1024, type: Premium_LRS, lun: 11, name: ASMSR1PRDJ }
  - { size: 512, type: Premium_LRS, lun: 12, name: ASMORARCHA }
  - { size: 512, type: Premium_LRS, lun: 13, name: ASMORARCHB }
  - { size: 512, type: Premium_LRS, lun: 14, name: ASMORARCHC }
  - { size: 512, type: Premium_LRS, lun: 15, name: ASMORARCHD }
  - { size: 128, type: Premium_LRS, lun: 16, name: ASMORALOG1A }
  - { size: 128, type: Premium_LRS, lun: 17, name: ASMORALOG2A }
  - { size: 512, type: Premium_LRS, lun: 18, name: ASMORAFLASHA }
  - { size: 16, type: Premium_LRS, lun: 19, name: ASMCRSA }

and the directory of /dev/disk/azure/scsi1 is:
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun0 -> ../../../sdx
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun0-part1 -> ../../../sdx1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun1 -> ../../../sdc
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun10 -> ../../../sdq
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun10-part1 -> ../../../sdq1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun11 -> ../../../sdj
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun11-part1 -> ../../../sdj1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun12 -> ../../../sdf
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun12-part1 -> ../../../sdf1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun13 -> ../../../sdd
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun13-part1 -> ../../../sdd1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun14 -> ../../../sdl
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun14-part1 -> ../../../sdl1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun15 -> ../../../sdm
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun15-part1 -> ../../../sdm1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun16 -> ../../../sdu
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun16-part1 -> ../../../sdu1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun17 -> ../../../sdh
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun17-part1 -> ../../../sdh1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun18 -> ../../../sdv
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun18-part1 -> ../../../sdv1
lrwxrwxrwx. 1 root root  12 Dec 11 17:54 lun19 -> ../../../sdn
lrwxrwxrwx. 1 root root  13 Dec 11 17:54 lun19-part1 -> ../../../sdn1
lrwxrwxrwx. 1 root root  

Re: [ansible-project] Setting Conditionals with Output

2020-08-11 Thread Jean-Yves LENHOF

Hi,

Perhaps using the module which does this, you'll have the idempotence ;-)

https://docs.ansible.com/ansible/latest/modules/win_share_module.html

Regars,

JYL


Le 11/08/2020 à 17:00, jhix...@gmail.com a écrit :
New at Ansible and still trying to get the hang of setting conditional 
based upon output.


I am setting Windows file shares with the below task. The initial run 
works fine; however, when you repeat the task, it fails stating that 
the shares already exist. How do I set a conditional that states if 
the network share already exists ignore, move on, rather than fail the 
run.


Task:

- name: Set File Shares
  win_shell: |
    net share WebContent="E:\Inetpub\wwwroot" /Grant:Everyone,READ 
/Grant:OSC\ServerAdministrator,CHANGE

    net share LogFiles="F:\Inetpub\LogFiles" /Grant:Everyone,READ
    net share Indexes="C:\Indexes" /Grant:Everyone,READ 
/Grant:OSC\ServerAdministrator,CHANGE
    net share Components="C:\Component Services" /Grant:Everyone,READ 
/Grant:OSC\ServerAdministrator,CHANGE
    net share Resources="C:\Inetpub" /Grant:Everyone,READ 
/Grant:OSC\ServerAdministrator,CHANGE


Output:

STDOUT:

LogFiles was shared successfully.

STDERR:

The name has already been shared.

More help is available by typing NET HELPMSG 2118.

The name has already been shared.

More help is available by typing NET HELPMSG 2118.

The name has already been shared.

More help is available by typing NET HELPMSG 2118.

The name has already been shared.

More help is available by typing NET HELPMSG 2118.


MSG:

non-zero return code
--
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/ee5cc554-c461-486f-88ca-13d18e1f940bn%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/4320c0ef-bbf7-b564-47e5-f0476b0f16d5%40lenhof.eu.org.


Re: [ansible-project] Re: Privilege escalation error when running a sudo command on AWS Ubuntu machine

2020-08-07 Thread Jean-Yves LENHOF

Hi,

su and sudo are two ways to become another user. So both method are 
available in ansible. Very often indeed in public cloud, this is the 
sudo way which is used during the provisionning of the server and 
assigning ssh key


"man su" and "man sudo" should help you to understand differences.

Regards,

JYL

Le 08/08/2020 à 01:18, lovesh harchandani a écrit :
Resolved by changing /su/ to /sudo/ in /become_method/, i.e. changing 
become_method:su to become_method: su*do**. *The docs mention *su* 
however. Is this a bug in Ansible itself where it say in the error 
message that /su/ is not acceptable or are /su/ and /sudo/ meant to do 
different things?


On Saturday, August 8, 2020 at 2:23:09 AM UTC+5:30 lovesh harchandani 
wrote:


Hi.
I am trying to install a package on an AWS Ubuntu machine using
ansible and getting error

FAILED! => {"msg": "Timeout (42s) waiting for privilege escalation
prompt: "}

I have tried with high timeouts as suggested online. The package I
am trying to install is docker and so it should take much time.
Moreover, I am watching the file /var/log/auth.log while I run the
playbook but cannot see any activity.
/I am able to do non-sudo actions however./

My ansible playbook is as follows

- hosts: '{{ host }}'
  tasks:
  - name: run lsb_releaset to check SSH works
     shell: lsb_release -a
   - name: Install docker if not already
     become: yes
     become_method: su
     package:
          name: "docker-ce"
          state: present

And my hosts file is as

[node]


[node:vars]
ansible_ssh_user=ubuntu
ansible_ssh_private_key_file=

I am running ansible as

ansible-playbook -i hosts playbook.yml --extra-vars "host=node" -T
40 -v

--
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/1c6fde35-f469-4da6-9d84-bf44db250194n%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/7f64a6dc-dbcf-5d24-02e4-f11093693646%40lenhof.eu.org.


Re: [ansible-project] Ansible on Azure Pipelines

2020-08-07 Thread Jean-Yves LENHOF

Hi,

Does not know about Azure pipelines...

But be aware that using ping module is already using ssh connection, not 
a simple ping


Regards,


JYL

Le 07/08/2020 à 14:15, Swapna Priya a écrit :
Has anyone used Ansible in Azure pipelines? I am using a simple ping 
command to connect to a VM. It throws an error that it is unreachable.

--
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/1b3ec6f8-3ce1-4639-ab0f-50e96e8a58f5o%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/0957cce7-daee-3e7e-6eb2-3328b28faa3a%40lenhof.eu.org.


Re: [ansible-project] Unable to update debian header and build essential using Ansible playbook

2020-08-05 Thread Jean-Yves LENHOF

Hello,

There's a lock on a fact during the gather fact... There's probably 
something which goes wrong on your server you need to fix


You can try to limit the gather fact to see where the problem could 
be Explications on how to do it is there :


https://stackoverflow.com/questions/34485286/how-to-filter-gathering-facts-inside-a-playbook

I've had this problem with :

- lvm command not responding on a server for example...

- rpm corrupted database

but there can be others reasons

Regards,

JYL

Le 05/08/2020 à 19:12, abhishek verma a écrit :

|
-hosts:DEV1
  become:yes
  tasks:
-name:"Update linux headers"
    apt:
     name:"linux-headers-{{ ansible_kernel }}"
|
After running this the ansible hangs after fact gathering. Please find 
the output below:


|
ansibleuser@debian:~/ansible_code$ ansible-playbook -vvv 
playbooks/second-playbook.yaml

ansible-playbook 2.9.11
  config file =/home/ansibleuser/ansible_code/ansible.cfg
  configured modulesearch path 
=['/home/ansibleuser/.ansible/plugins/modules','/usr/share/ansible/plugins/modules']
  ansible python modulelocation 
=/usr/local/lib/python3.5/dist-packages/ansible

  executable location =/usr/local/bin/ansible-playbook
  python version =3.5.3(default,Jul92020,13:00:10)[GCC 6.3.020170516]
Using/home/ansibleuser/ansible_code/ansible.cfg asconfig file
host_list declined parsing /home/ansibleuser/ansible_code/inventory 
asit did notpassits verify_file()method
script declined parsing /home/ansibleuser/ansible_code/inventory asit 
did notpassits verify_file()method
autodeclined parsing /home/ansibleuser/ansible_code/inventory asit did 
notpassits verify_file()method
Parsed/home/ansibleuser/ansible_code/inventory inventory source 
withini plugin



PLAYBOOK:second-playbook.yaml 
*

1plays inplaybooks/second-playbook.yaml


PLAY 
[DEV1]



TASK 
[GatheringFacts]*

task path:/home/ansibleuser/ansible_code/playbooks/second-playbook.yaml:1
<192.168.1.153>ESTABLISH SSH CONNECTION FOR USER:idriveadmin
<192.168.1.153>SSH:EXEC ssh -C -o ControlMaster=auto-o 
ControlPersist=60s-o Port=1460-o 
'IdentityFile="/home/ansibleuser/ansibleuserkey"'-o 
KbdInteractiveAuthentication=no-o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no-o 'User="idriveadmin"'-o 
ConnectTimeout=10-o 
ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 
192.168.1.153'/bin/sh -c '"'"'echo ~idriveadmin && sleep 0'"'"''

<192.168.1.153>(0,b'/home/idriveadmin\n',b'')
<192.168.1.153>ESTABLISH SSH CONNECTION FOR USER:idriveadmin
<192.168.1.153>SSH:EXEC ssh -C -o ControlMaster=auto-o 
ControlPersist=60s-o Port=1460-o 
'IdentityFile="/home/ansibleuser/ansibleuserkey"'-o 
KbdInteractiveAuthentication=no-o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no-o 'User="idriveadmin"'-o 
ConnectTimeout=10-o 
ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 
192.168.1.153'/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo 
/home/idriveadmin/.ansible/tmp `"&& mkdir 
/home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896 
&& echo ansible-tmp-1596646753.1827192-28335-58868948093896="` echo 
/home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896 
`" ) && sleep 0'"'"''

<192.168.1.153>(0,b'ansible-tmp-1596646753.1827192-28335-58868948093896=/home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896\n',b'')
Attemptingpython interpreter discovery
<192.168.1.153>ESTABLISH SSH CONNECTION FOR USER:idriveadmin
<192.168.1.153>SSH:EXEC ssh -C -o ControlMaster=auto-o 
ControlPersist=60s-o Port=1460-o 
'IdentityFile="/home/ansibleuser/ansibleuserkey"'-o 
KbdInteractiveAuthentication=no-o 
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey 
-o PasswordAuthentication=no-o 'User="idriveadmin"'-o 
ConnectTimeout=10-o 
ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 
192.168.1.153'/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; 
command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command 
-v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v 
'"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v 
'"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v 
'"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v 
'"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v 
'"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; 
command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command 
-v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 
0'"'"''

<192.168.1

Re: [ansible-project] Unable to receive Emall despite of success message from ansible script

2020-07-25 Thread Jean-Yves LENHOF

If so, what the logs says ?

I'm not sure you understand what is daemon listening on port 25 ?

Regards,


Le 25/07/2020 à 18:50, Samir Kothawade a écrit :
Yes it is. Actually I took the reference of an ansible documentation 
site for this writing above script. Here is the ref. screenshot  from 
ansible documentation.


image.png

On Sat, 25 Jul 2020 at 22:16, Jean-Yves LENHOF 
mailto:jean-y...@lenhof.eu.org>> wrote:


Look at your logs mail server(the one which answer on tcp port 25)
if there's something interesting in it...

Regards,


Le 25/07/2020 à 18:43, Samir Kothawade a écrit :

Ansible script:

- hosts: local
  gather_facts: no
  tasks:
   - name: mailing longevity report
     become: true
     mail:
        host: localhost
        port: 25
        from: j...@example.net <mailto:j...@example.net>
(Longevity Report)
        to: Samir Kothawade 
<mailto:kothawade.sa...@gmail.com>
        subject:  testing mail Longevity Report
        body: hi this is testing mail


Output observed after running above script:




I am not receiving emails after running above command despite if
success message from above script. Note -My network connectivity
is good and reachable to gmail as well.
Can someone help me out with 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-project+unsubscr...@googlegroups.com
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/08204b07-6128-416c-b89d-6dcddd41f0d2o%40googlegroups.com

<https://groups.google.com/d/msgid/ansible-project/08204b07-6128-416c-b89d-6dcddd41f0d2o%40googlegroups.com?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/b9f7d451-9c39-5f2f-01d0-a76aeb6e2b96%40lenhof.eu.org

<https://groups.google.com/d/msgid/ansible-project/b9f7d451-9c39-5f2f-01d0-a76aeb6e2b96%40lenhof.eu.org?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAA%3Dr5yedn4WgwpGUiBcY__avQwGW_G2q5WrAUN2VU2Sc4Tj24Q%40mail.gmail.com 
<https://groups.google.com/d/msgid/ansible-project/CAA%3Dr5yedn4WgwpGUiBcY__avQwGW_G2q5WrAUN2VU2Sc4Tj24Q%40mail.gmail.com?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0ad17391-d14e-1e98-47fe-0f2f5950f134%40lenhof.eu.org.


Re: [ansible-project] Unable to receive Emall despite of success message from ansible script

2020-07-25 Thread Jean-Yves LENHOF
Look at your logs mail server(the one which answer on tcp port 25) if 
there's something interesting in it...


Regards,


Le 25/07/2020 à 18:43, Samir Kothawade a écrit :

Ansible script:

- hosts: local
  gather_facts: no
  tasks:
   - name: mailing longevity report
     become: true
     mail:
        host: localhost
        port: 25
        from: j...@example.net (Longevity Report)
        to: Samir Kothawade 
        subject:  testing mail Longevity Report
        body: hi this is testing mail


Output observed after running above script:




I am not receiving emails after running above command despite if 
success message from above script. Note -My network connectivity is 
good and reachable to gmail as well.

Can someone help me out with 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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/08204b07-6128-416c-b89d-6dcddd41f0d2o%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/b9f7d451-9c39-5f2f-01d0-a76aeb6e2b96%40lenhof.eu.org.


Re: [ansible-project] Can playbook tag input be placed in group_var?

2020-07-23 Thread Jean-Yves LENHOF

Hi,

I think you should be asking what you want to do more clearly (Perhaps 
with a little playbook to be completed) instead of trying some obscured 
things


Regards,

JYL


Le 23/07/2020 à 19:37, Gerry Maddock a écrit :
If I'm running a playbook that has tags, can I place the tag 
information be placed in the group_vars?  That way if I run a playbook 
against against an ansible group with children, the children could 
have different tags for use in the playbook?



--
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/8dfab321-2bf5-41c2-9a6b-8fa7e315dd48o%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/806df9a1-2e34-0a51-fa4f-6949085ce9a8%40lenhof.eu.org.


Re: [ansible-project] Ansible Remote Versioning

2020-07-22 Thread Jean-Yves LENHOF

Hi,

I gave you some ideas, I did'nt say this is a good practice to know what 
tasks has been already ran.


When you produce ansible role and playbook, you should ensure that you 
can run it whenever previous state was and if run more than once without 
modification results on server should be the same !


Regards,


Le 22/07/2020 à 09:36, Firesh Bakhda a écrit :

Hi JYL,

This is a great insight you have provided. That would certainly a good 
way on how to manipulate the Ansible and Ansible Tasks on each runs.
What what it doesn't solve is that how do i populate that fact file 
with Tasks that has already been ran.


For example,  at the end of each Ansible run, if i could generate a 
JSON file that would look like:


{
    "Task1":1,
    "Task2":1
}

And on Ansible, I can write "When: {{ ansible_local["Task1"] }} exists 
and {{ ansible_local["Task1"] }} == 1"

then skip the task. This is ideal.

However, to generate the fact.d JSON file, i need a way for to know 
what tasks have been executed in the first place,
and thats something i am figuring out, how can i know within this 
ansible run, what were the tasks executed ?




On Tuesday, July 21, 2020 at 3:03:28 PM UTC+8 jyle...@gmail.com wrote:

Interesting question.

A local fact is a way :


https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#local-facts-facts-d

At the beginning of your playbook you test is the fact relating to
your playbook exist.

If existing, is the version different from the playbook you use

Do things differently if the version is x or y


Generally, this could be avoided using some automated test to not
make regression in a future version (molecule could be useful here
if target is a server)

Regards,

JYL
||


Le 21/07/2020 à 08:08, Firesh Bakhda a écrit :

Hi ,

I would like to post to this group to find out if there is anyway
for ansible to actually stamp the client with
Ansible Deployment or Deployment Stamp on what tasks were ran and
when it was ran, like a VERSION or DEPLOYMENT file that we could
deposit to the targets.

For example,

On first deployment the ansible scripts may just have tasks
like:

 1. APT UPDATE
 2. NTPDATE

this then was deployment and stamps on the client like this:

 1. Ansible Deployment 21/07/2020 13.35pm - v1.0
 1. Tasks:
 1. APT UPDATE 21/072020 13;40pm
 2. NTPDATE 21/072020 13.42pm


Then this ansible script was updated to contain 2 more tasks
like the below:

 1. APT UPDATE
 2. TIMESYNC DAEMON UPDATE
 3. NTPDATE
 4. PROXY UPDATE

And when this was ran again, the target system file gets
updated once it completes with:

 1. Ansible Deployment 21/07/2020 13.35pm - v1.0
 1. Tasks:
 1. APT UPDATE 21/072020 13;40pm
 2. NTPDATE 21/072020 13.42pm
 2. Ansible Deployment 21/07/2020 14.00pm - v1.1
 1. Tasks:
 1. APT UPDATE 21/07/2020 14.01pm
 2. TIMESYNC DAEMON UPDATE 21/07/2020 14.03pm
 3. NTPDATE 21/07/2020 14.04pm
 4. PROXY UPDATE 21/07/2020 14.07pm



Something like this, this allows those who are maintaining
individual platforms gets to know if the deployed platform is
upto date or not.
This would also help to know if the target system is to the
latest deployment or not.
Or is there any mechanism for 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-proje...@googlegroups.com.
To view this discussion on the web visit

https://groups.google.com/d/msgid/ansible-project/977f9bab-9572-40e2-a122-cbbc5295b830o%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/5737250d-e71e-406a-a1e2-aba8a1996079n%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 th

Re: [ansible-project] Need help for install java

2020-07-21 Thread Jean-Yves LENHOF

Hi,

Where did the package come from ? (sound like alien package of an rpm ?)

Some ideas :

- If the package came from Oracle, very often, an interaction is needed 
to accept EULA...  (I had that kind of problem on CentOS a while ago)


- Have you tried a manual install ?

- Also I saw that |xz-utils is needed on remote server (look at 
documentation on apt). Perhaps your playbook should ensure it is 
installed before...

|

|- If you want a specific jdk version not packaged for debian, use 
||*make*-jpkg to create a good package that can be installed without 
prompting user.

|

Regards,

JYL


Le 21/07/2020 à 22:41, Rajeeb sahoo a écrit :

- name: Install java DEB package
  hosts: ubuntu_test
  become: yes
  tasks:

    - name: Copy jdk.deb file
      copy:
        src: /home/centos/jdk1.8_1.8.0231-1_amd64.deb
        dest: /tmp

    - name: Installing jdk.deb package
      apt:
        deb: /tmp/jdk1.8_1.8.0231-1_amd64.deb
        state: present

    - name: Copy jre.deb file
      copy:
        src: /home/centos/jre1.8_1.8.0211-1_amd64.deb
        dest: /tmp

    - name: Installing jre.deb package
      apt:
        deb: /tmp/jre1.8_1.8.0211-1_amd64.deb
        state: present

Ran this. but it's not installing in remote rserver

On Wed, Jul 22, 2020 at 1:55 AM Dick Visser > wrote:


Best to get started first:

https://docs.ansible.com/ansible/latest/user_guide/intro_getting_started.html
Then try this for your first playbook:
https://docs.ansible.com/ansible/latest/modules/apt_module.html

On Tue, 21 Jul 2020 at 22:05, rajeeb...@scienaptic.com

mailto:rajeeb.sa...@scienaptic.com>>
wrote:
>
> Hello,
> I am new in Ansible.
> I need to install ORACLE JAVA 8 and that package is in .deb.
(jdk1.8_1.8.0231-1_amd64.deb, jre1.8_1.8.0211-1_amd64.deb)
> can anyone help me out to write ansible code for install java
with the above condition?
>
>
>
> Thanks
> Rajeeb
>
> --
> 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/6c4450ad-a133-43ff-80e9-2c7af4b43b3cn%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/CAL8fbwN6fa%3Dg0ogztq1R1PmuhN5PDqz9s01zZXEK149y9Li9Cw%40mail.gmail.com.



--
*Thanks & Regards,
*
*Rajeeb Sahoo*
--
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/CAEzMhAYRJmpVqB7870yedTB4aSBDWh%3DH1zZ%2Brj1RWD_JfU0vtg%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/93480ccc-998c-8ea0-a4af-37ef0dd65c2b%40lenhof.eu.org.


Re: [ansible-project] Ansible Remote Versioning

2020-07-21 Thread Jean-Yves LENHOF

Interesting question.

A local fact is a way :

https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#local-facts-facts-d

At the beginning of your playbook you test is the fact relating to your 
playbook exist.


If existing, is the version different from the playbook you use

Do things differently if the version is x or y


Generally, this could be avoided using some automated test to not make 
regression in a future version (molecule could be useful here if target 
is a server)


Regards,

JYL
||


Le 21/07/2020 à 08:08, Firesh Bakhda a écrit :

Hi ,

I would like to post to this group to find out if there is anyway for 
ansible to actually stamp the client with
Ansible Deployment or Deployment Stamp on what tasks were ran and when 
it was ran, like a VERSION or DEPLOYMENT file that we could deposit to 
the targets.


For example,

On first deployment the ansible scripts may just have tasks like:

 1. APT UPDATE
 2. NTPDATE

this then was deployment and stamps on the client like this:

 1. Ansible Deployment 21/07/2020 13.35pm - v1.0
 1. Tasks:
 1. APT UPDATE 21/072020 13;40pm
 2. NTPDATE 21/072020 13.42pm


Then this ansible script was updated to contain 2 more tasks like
the below:

 1. APT UPDATE
 2. TIMESYNC DAEMON UPDATE
 3. NTPDATE
 4. PROXY UPDATE

And when this was ran again, the target system file gets updated
once it completes with:

 1. Ansible Deployment 21/07/2020 13.35pm - v1.0
 1. Tasks:
 1. APT UPDATE 21/072020 13;40pm
 2. NTPDATE 21/072020 13.42pm
 2. Ansible Deployment 21/07/2020 14.00pm - v1.1
 1. Tasks:
 1. APT UPDATE 21/07/2020 14.01pm
 2. TIMESYNC DAEMON UPDATE 21/07/2020 14.03pm
 3. NTPDATE 21/07/2020 14.04pm
 4. PROXY UPDATE 21/07/2020 14.07pm



Something like this, this allows those who are maintaining individual 
platforms gets to know if the deployed platform is upto date or not.
This would also help to know if the target system is to the latest 
deployment or not.

Or is there any mechanism for 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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/977f9bab-9572-40e2-a122-cbbc5295b830o%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/c671d7e2-49dd-8f1b-b5b9-ce643e3bec72%40lenhof.eu.org.


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

2020-07-14 Thread Jean-Yves LENHOF
Hi, Not tested, but should be closed to what you're looking into : - 
getent: database: group key: monitor split: ':' - debug: var: 
getent_group[1]



Regards,

JYL


Le 14/07/2020 à 21:58, Laci a écrit :
Do you guys have a good idea what is the best way to determine a 
group's id them reuse that in a variable?


For ex:
% getent group monitor
monitor:x:990:polkitd

I need 990, then I have to add a line to /etc/fstab including 990
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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/517da774-3826-4de3-b5da-17f128df2a68o%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/6d99c89a-1bca-90b5-c878-95ff864cda0b%40lenhof.eu.org.


Re: [ansible-project] Task to modify an ansible host's ip-addr while connected

2020-07-01 Thread Jean-Yves LENHOF

Hi,

Perhaps you should look around "meta: reset_connection" described here :

https://docs.ansible.com/ansible/latest/modules/meta_module.html

Little more details here :

https://www.ansible.com/blog/rebooting-network-devices-with-ansible


But I think you have another problem to manage the ip changeSo you 
probably need to update your inventory directly in your ansible playbook 
or have two different objects in your inventory, so have two play in 
your playbook.


Regards,

JYL

Le 01/07/2020 à 09:53, Momodou Fatty a écrit :

 - I have a router/host: mgmt_ip_addr = *1.1.1.1*
 - I use ansible to connect to this router/host
 - My task is to apply a new configuration to this router.
 - This new config will modify the mgmt_ip_addr of the host to *2.2.2.2*

You see the problem here? I used 1.1.1.1 to connect to this host. Now 
I'm planning on modifying this ip to 2.2.2.2
As soon as the new config gets applied, my ansible ssh session breaks. 
Makes sense, my new config modified the mgmt ip.


However, I have a*bgp task* that should run after the new config has 
been applied. Obviously this *bgp task *never gets run because the 
session is already broken.


Is there a workaround for this? I want to be able to change and mgmt 
ip and continue working on other tasks after that during the same 
playbook run.


|
---## RENDER CONFIG, AND DO CONFIG OVERRIDE - name: "Rendering Junos 
jinja template into conf"template:      src:"template_full_config.j2"  
    
dest:"/Users/mfatty/Projects/ansible/nql_ansible/roles/junos_dut_role/rendered_full_config.conf"  
  tags:config_override-name:"load override with new config"    
juniper_junos_config:      provider:"{{ credentials }}"      
config_mode:"private"      load:"override"      
src:"/Users/mfatty/Projects/ansible/nql_ansible/roles/junos_dut_role/rendered_full_config.conf"  
    format:"text"register:response     tags:config_override-debug:msg 
={{response }}    tags:config_override## VERIFY BGP STATE-name:check 
bgp status     juniper_junos_command:      provider:"{{ credentials 
}}"      commands:"show bgp summary"    tags:verify_bgp 
register:response-debug:var:response.stdout_lines     tags:verify_bgp

|


Thanks
Mo.
--
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/77463894-dd66-43ca-800e-2f0f36276725o%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/4d705ef8-10b9-cdec-117f-e13d7dad0c0f%40lenhof.eu.org.


Re: [ansible-project] string not recognised in groups_vars/all

2020-06-30 Thread Jean-Yves LENHOF

Dot, dash are operators in python on which ansible is based...

It is not a good idea to use them, but if you use them, there is some 
notices about it here :


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

And there are issue :

https://github.com/ansible/ansible/issues/56930

So please, do not used them in variables... It should save you times

Regards,


Le 30/06/2020 à 12:28, Johana Galarza Monta a écrit :
I have a the below in my groups vars, and in a role I am trying to add 
a conditional on `module-a` such as when: " 'module-a' in module" but 
keeps throwing me this error


{"msg": "The conditional check ' 'module-a' in modules' failed. The 
error was: error while evaluating conditional ( 'module-a' in 
modules): Unable to look up a name or access an attribute in template 
string ({% if  'module-a in modules %} True {% else %} False {% endif 
%}).\nMake sure your variable name does not contain invalid characters 
like '-': argument of type 'AnsibleUndefined' is not iterable.


 but somehow it works when I put this in the playbook itself...

Did anyone had such an issue? Or any idea why this works on the 
playbook but not under gorup_vars/all...??


vars:
module:
- module-a
--
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/a094e83f-bd27-402a-9b73-ccbc9f6d5058o%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/edb4a672-926e-bf53-b2bf-8fb844919002%40lenhof.eu.org.


Re: [ansible-project] Re: Vm mount iso and install vmware tools

2020-05-26 Thread Jean-Yves LENHOF

Hi,

Just a guess (I'm not a windows man)...Perhaps you need to do silent 
install because you are not "desktop logged" when you use ansible.


Have a look here for some example (you need to look for the good ones 
for your version, but you've got the idea)


https://uncomplicatingit.com/vmware/command-to-do-a-complete-vmware-tools-install-silently/

Regards,


JYL


Le 26/05/2020 à 22:46, Tony Wong a écrit :

but I got all the steps working except win_package,

There seems to be something wrong with execution.

I manually ran the setup.exe and works

On Tue, May 26, 2020 at 12:18 PM David Foley > wrote:


instead of the win_get_url use the win_package that will install
the application for you vm_tools

  win_package:
          path:
https://repo.saltstack.com/windows/Salt-Minion-3000-Py3-AMD64-Setup.exe
          product_id: 'Salt-Minion-3000-Py3-AMD64-Setup.exe'
          arguments: 'Salt-Minion-3000-Py3-AMD64-Setup.exe /S
/master={{ master }} /minion-name={{ minion }}'
          state: present

-- 
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/8a1c6358-a435-4069-9c3c-a3fbdc738e4c%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/CALmkhkqU4_KHjM%2B5Y9_XZWNLVGcL-wKHfnhPHXAxmWG7kqyS3Q%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/6c088b60-9c8c-dcbd-79e9-416e60c12928%40lenhof.eu.org.


Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-19 Thread Jean-Yves LENHOF
Use copy (to copy on the second server), fetch (to get the file on the 
controller), and stat (to get rights) modules


Regards,

JYL


Le 19/05/2020 à 22:38, Laci a écrit :
Another detail is that serverA can't talk to serverB or vice versa, 
only the Ansible server can talk to both of them


On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote:

I have some files with 0400/-r permissions on server A
that I need to copy to server B and preserve permissions.

For example:
serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key

How would you do it?

--
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/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%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/eda34672-2eab-bf70-554f-758c4273d729%40lenhof.eu.org.


Re: [ansible-project] Vm mount iso and install vmware tools

2020-05-19 Thread Jean-Yves LENHOF
As written in my email : win_get_url module


⁣Télécharger BlueMail pour Android ​

Le 19 mai 2020 à 17:42, à 17:42, Tony Wong  a écrit:
>I am not sure.  because curl is not available on windows boxes.
>
>On Tue, May 19, 2020 at 8:16 AM Jean-Yves LENHOF
>
>wrote:
>
>> Hi,
>>
>> Why not using curl on this site or into an internal server
>synchronized on
>> this server :
>>
>> https://packages.vmware.com/tools/esx/index.html
>>
>> For example you have direct executable here :
>>
>> https://packages.vmware.com/tools/esx/6.7u3/windows/x64/
>>
>> Use win_get_url module and win_command_module should help...
>>
>> Using this technique it's up to you to install whatever vmware
>toolbox you
>> wantrespecting the matrix on the vmware website on host and guest
>>
>> (Sometime you can install a vmware tools not available on iso using
>this
>> tip but compatible with your guest/host combination)
>>
>> Regards,
>>
>> JYL
>>
>>
>> Le 19/05/2020 à 15:56, Tony Wong a écrit :
>>
>> IS there a playbook or how do i start with installing  and upgrading
>> vmware tools on windows vm
>>
>> for VM with no tools installed
>>
>> I need to
>>
>> 1. mount the vmware tools iso
>> 2. run the setup64.exe /S /v “/qn REBOOT=R ADDLOCAL=ALL”
>>
>>
>> any idea how to start with 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-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/ansible-project/fe25871a-3987-4430-93a0-805bc40be8ac%40googlegroups.com
>>
><https://groups.google.com/d/msgid/ansible-project/fe25871a-3987-4430-93a0-805bc40be8ac%40googlegroups.com?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/ansible-project/c9857c3e-13b7-5300-1d47-d7b2a5315d99%40lenhof.eu.org
>>
><https://groups.google.com/d/msgid/ansible-project/c9857c3e-13b7-5300-1d47-d7b2a5315d99%40lenhof.eu.org?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ansible-project/CALmkhkqrcpSf-2Z3C7hQyZ-otzVCs8SR67FndJcDUSBuX1YYcg%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/04e6e6e5-b650-45bb-878a-7c402b085930%40lenhof.eu.org.


Re: [ansible-project] Vm mount iso and install vmware tools

2020-05-19 Thread Jean-Yves LENHOF

Hi,

Why not using curl on this site or into an internal server synchronized 
on this server :


https://packages.vmware.com/tools/esx/index.html

For example you have direct executable here :

https://packages.vmware.com/tools/esx/6.7u3/windows/x64/

Use win_get_url module and win_command_module should help...

Using this technique it's up to you to install whatever vmware toolbox 
you wantrespecting the matrix on the vmware website on host and guest


(Sometime you can install a vmware tools not available on iso using this 
tip but compatible with your guest/host combination)


Regards,

JYL


Le 19/05/2020 à 15:56, Tony Wong a écrit :
IS there a playbook or how do i start with installing  and upgrading 
vmware tools on windows vm


for VM with no tools installed

I need to

1. mount the vmware tools iso
2. run the setup64.exe /S /v “/qn REBOOT=R ADDLOCAL=ALL”


any idea how to start with 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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fe25871a-3987-4430-93a0-805bc40be8ac%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/c9857c3e-13b7-5300-1d47-d7b2a5315d99%40lenhof.eu.org.


Re: [ansible-project] Task reported as "changed" even if unchanged

2020-05-16 Thread Jean-Yves LENHOF

Hi,

you should better use systemd module instead of command to do what you 
intended to do... This module is better at idempotence that command


Command is not idempotent by default, you have to do it (there are 
different ways to do it), this is why you have some changes


Regards,

Le 16/05/2020 à 12:20, Marc Haber a écrit :

Hi,

the following task:

- name: configure systemd-timesyncd - check unit active
   command:
 argv:
   - "systemctl"
   - "is-enabled"
   - "systemd-timesyncd"
   check_mode: no
   register: systemd_timesyncd_unit_enabled

yields a "changed" in the playbook output:

TASK [systemd-timesyncd : configure systemd-timesyncd - check unit active] *
changed: [news1]
changed: [check]
changed: [slide]

Can I have ansible ignore that and output an "ok" instead for cosmetic reasons
and for statistics?

Greetings
Marc



--
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/a4fcc52b-906b-336d-6138-415d06e11f68%40lenhof.eu.org.


Re: [ansible-project] Automate Oracle Database Shutdown and Startup with Ansible.

2020-05-16 Thread Jean-Yves LENHOF

There's no /etc/oratab on yours servers ?

Regards,


Le 16/05/2020 à 08:30, Akshay Bora a écrit :

Hi Everyone,

I am writing an ansible script to automate the task of oracle database 
shutdown and startup. I am facing a difficulty in reading the 
environment variables from the XML files.


Sample XML File:

[oracle@rac1 ContentsXML]$ more inventory.xml





   12.1.0.2.0
   2.1.0.6.0


IDX="1" CRS="true"/>
IDX="2"/>





[oracle@rac1 ContentsXML]$

One challenge for this is the path of this XML file is not same on 
every server.


Can someone please help me to fetch the exact path of the xml file and 
grep the value of OraDB12Home1= /oracle/app/product/12.1.0 out of xml 
and store in ansible variable?


--
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/d78cb9de-e120-4f5e-9414-8576f9c84632%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/2dfa4f18-6058-ed70-4f94-6f1bba7ceea6%40lenhof.eu.org.


Re: [ansible-project] fatch module

2020-05-15 Thread Jean-Yves LENHOF
I rather would use something like syslog, logstash, filebeat to do this 
type of job instead of ansible...


Regards,

JYL


Le 15/05/2020 à 09:53, rakesh rathore a écrit :

Hi Team,

Can anyone slove this for me please?


Imaginetherearemanyserversrunninginproductionsetupandstoringsomedataata 
particular location on each server. The file name of each server is 
unique and follows a 
specificpattern.thefilenamestartswiththehostnamedateandtimestampendingwith


.TXT. as soon as the file reaches 100 MB a remote server should fetch 
the file and store it locally. The file will keep on getting appended 
on the respective server but a remote server will keep on tracking the 
file size and keep on thinking it on its local directory.


Suppose there are 10 servers which are in production naming from 
host1-10 and the remote server named as rm1. the script on server rm1 
will keep on checking the size of the file being written on each of 
the hosts 1 to 10. As soon as the file size reaches 100 MB the file 
should be synced to RM1 server. The script should make sure that it is 
only downloading the latest data not the data which had if it had 
previously downloaded. File has become 1.5 GB but the server rm1 has 
already downloaded 1.5 GB of data so any new 100Mb that is being 
appended to this file shall be sent over the network to RM1 server not 
the entire 1.6 GB of data.


Its free exam test

I am trying slove this
- hosts: Producton tasks: - fetch: dest: /root/filename.TXT src: 
/home/backup flat: yes




--
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/13b79472-d3ef-38c2-536e-22640eb80e04%40lenhof.eu.org.


Re: [ansible-project] Re: Window patch module not working on 2.9 Ansible

2020-05-12 Thread Jean-Yves LENHOF

Hi,

First thing I see is that attribute "catagory_names" should be 
"category_names".


I think there's another problem also, but don't see it yet...


Regards,

JYL

*
*

Le 12/05/2020 à 07:36, Amit Kumar a écrit :
Any help will be really appreciable, As i am stuck here and waste day 
but didn't find any solution





On Monday, May 11, 2020 at 7:19:55 PM UTC+5:30, Amit Kumar wrote:

Hi ,

I tried to installed the window patch with below yml but it's not
installing the found patch.
It just search the patch and skipped that patch, kindly please
suggest
Where i am doing wrong.

I have mention the Yml file and output of playbook.


Window patch installation win_patch.yml file

---
# update-windows-test.yaml
- hosts: win
  vars:
    win_updates_categories:
  - SecurityUpdates
  - CriticalUpdates
  - UpdateRollups
  - DefinitionUpdates
  - Updates
  - Application
  - Connectors
  - DeveloperKits
  - FeaturePacks
  - Guidance
  - ServicePacks
  - Tools
  - UpdateRollups

  tasks:
    # Check for missing updates
    - name: check for missing updates
  win_updates:
    state: searched
    catagory_names: "{{ win_updates_categories }}"
  register: update_count
  ignore_errors: yes

    - name: reboot if required
  win_reboot:
  when: update_count.reboot_required
  ignore_errors: yes
 #Install updates
    - name: install updates
  debugger: on_skipped
  win_updates:
    catagory_names: "{{ win_updates_categories }}"
    reboot: yes
    register: update_result


---
Output


ansible@ansible:~/rx_testing$ ansible-playbook win_patch_file3.yml
-vvv
ansible-playbook 2.9.7
  config file = /home/ansible/rx_testing/ansible.cfg
  configured module search path =
[u'/home/ansible/.ansible/plugins/modules',
u'/usr/share/ansible/plugins/modules']
  ansible python module location =
/usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
Using /home/ansible/rx_testing/ansible.cfg as config file
host_list declined parsing /home/ansible/rx_testing/inventory as
it did not pass its verify_file() method
script declined parsing /home/ansible/rx_testing/inventory as it
did not pass its verify_file() method
auto declined parsing /home/ansible/rx_testing/inventory as it did
not pass its verify_file() method
Parsed /home/ansible/rx_testing/inventory inventory source with
ini plugin

PLAYBOOK: win_patch_file3.yml

***
1 plays in win_patch_file3.yml

PLAY [win]

**

TASK [Gathering Facts]

**
task path: /home/ansible/rx_testing/win_patch_file3.yml:3
Using module file
/usr/lib/python2.7/dist-packages/ansible/modules/windows/setup.ps1
Pipelining is enabled.
<10.100.100.206> ESTABLISH WINRM CONNECTION FOR USER:
Administrator on PORT 5986 TO 10.100.100.206
EXEC (via pipeline wrapper)
ok: [10.100.100.206]
META: ran handlers

TASK [check for missing updates]


task path: /home/ansible/rx_testing/win_patch_file3.yml:22
win_updates: running win_updates module
Using module file
/usr/lib/python2.7/dist-packages/ansible/modules/windows/win_updates.ps1
Pipelining is enabled.
<10.100.100.206> ESTABLISH WINRM CONNECTION FOR USER:
Administrator on PORT 5986 TO 10.100.100.206
EXEC (via pipeline wrapper)
ok: [10.100.100.206] => {
    "changed": false,
    "filtered_updates": {
    "05775fa0-d13e-49eb-89dc-74fba83fcdbf": {
    "categories": [
    "Definition Updates",
    "Windows Defender"
    ],
    "filtered_reason": "category_names",
    "id": "05775fa0-d13e-49eb-89dc-74fba8

Re: [ansible-project] Re: strange variable behaviour/error

2020-05-10 Thread Jean-Yves LENHOF
OK here is the playbook. What is the complete template, the inventory 
you use and the command you've used ?


Regards,

Le 09/05/2020 à 18:25, Alfredo De Luca a écrit :

Apologies if it wasn't clear.
So it's a playbook that create an inventory file from a template for 
kolla-ansible so it can install Openstack.


here is the playbook

---
- name: TEMPLATES
  file:
      path: "{{ deploy_env }}/my_envs/openstack/{{ deploy_env }}"
      state: directory
      mode: 0755

- name: Create inventory file from a template
  template:
      src: templates/osk_inventory.j2
      dest: "{{ deploy_env }}/my_envs/openstack/{{ deploy_env 
}}/osk_inventory_{{ deploy_env }}"

      owner: root
      group: root


On Sat, May 9, 2020 at 3:55 PM Alfredo De Luca 
mailto:alfredo.del...@gmail.com>> wrote:


Hi all.
I have ansible 2.9.7 running on ubuntu. I am just running some
test and one is to create an inventory by a template.
All good except when I use the template it says

*fatal: [instance]: FAILED! => {"changed": false, "msg":
"AnsibleUndefinedVariable: 'network_interface' is undefined"}
*

Now here is the inventory.j2 snip


[control]
{{ osk_nodes.split(',')[0] }}

[compute]
{% for node_ip in osk_nodes.split(',') %}
{{node_ip}}
{% endfor %}

[all:vars]
*network_interface=eno1*


Not sure why it keep saying undefined variable. where I
specifically set the network_interface to eno1.

Any ideas/suggestions?
Cheers




-- 
/*/Alfredo*/




--
/*/Alfredo*/

--
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/CAAWpFTFzh%2B_sJf8vBU%3DKga-M6MwyXOcH8pxVDL-9xn4rmqneig%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/d3de9870-4840-caa8-0e9c-bcc8c1fa7071%40lenhof.eu.org.


Re: [ansible-project] strange variable behaviour/error

2020-05-09 Thread Jean-Yves LENHOF

Hi,

Please give us a small case with all the pieces and how you run it 
(ansible-playbook )... You speak about an inventory but it is a 
template, sound strange given like this...


Le 09/05/2020 à 15:55, Alfredo De Luca a écrit :

Hi all.
I have ansible 2.9.7 running on ubuntu. I am just running some test 
and one is to create an inventory by a template.

All good except when I use the template it says

*fatal: [instance]: FAILED! => {"changed": false, "msg": 
"AnsibleUndefinedVariable: 'network_interface' is undefined"}

*

Now here is the inventory.j2 snip


[control]
{{ osk_nodes.split(',')[0] }}

[compute]
{% for node_ip in osk_nodes.split(',') %}
{{node_ip}}
{% endfor %}

[all:vars]
*network_interface=eno1*


Not sure why it keep saying undefined variable. where I specifically 
set the network_interface to eno1.


Any ideas/suggestions?
Cheers




--
/*/Alfredo*/

--
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/CAAWpFTH6R_mpCgd%2BW3ubGnPrJGmy12a-gJAhPZ2-WtTtZSHuGA%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/8fe9eb28-2074-e5a9-44df-64a25fb6ffe8%40lenhof.eu.org.


Re: [ansible-project] Need ideas how to reflect progress os ansible job in web page

2020-05-08 Thread Jean-Yves LENHOF

Hi,

Use ARA ?

https://ara.recordsansible.org/

Regards,


JYL

Le 08/05/2020 à 14:39, Meir Yanovich a écrit :

hello all
i have a simple web page that invokes the ansible job via command line
as high level idea how can i reflect some progress from the ansible 
job to the web page

can i set some callbacks or any other idea?
I'm not using API I'm running playbook as Linux cli .
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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f1b6f04c-b3d6-46d4-9aa4-493f381b63f5%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/a902a8d2-58b7-a367-b068-d64e70207f08%40lenhof.eu.org.


Re: [ansible-project] how can i execute the following oracle sql commands using ansible and get the value back to be stored in variable

2020-05-07 Thread Jean-Yves LENHOF

Hi,

Perhaps, you should have a look on these :

https://github.com/oravirt/ansible-oracle

https://github.com/oravirt/ansible-oracle-modules

A lot of works has been done here

If you don't want all of these, a step in the right direction here :

https://stackoverflow.com/questions/41796466/ansible-playbook-to-execute-oracle-script

Regards,


Le 28/02/2018 à 11:58, Gopi Krishna a écrit :

HI,

MY playbook:

sample.sh:
. /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env
val='v$archived_log'
R=`sqlplus '/as sysdba'< 0;
exit;
EOF`

echo $R


I am trying to achieve the same through ansible using shell command, 
but im getting the error


- hosts: source
  tasks:
        - include_vars: sql.yml
        - shell: |
                . /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env
                val='v$archived_log'
                R=`sqlplus '/as sysdba' <<-EOF
                set numw 1 lines 80 pages 0;
                select max(NEXT_CHANGE#) "RMAN_SCN" from $val  where 
BACKUP_COUNT > 0;

                exit;
                EOF`
                echo $R
          register: cmd
        - debug:
                msg: "{{cmd}}"

error:
TASK [debug] 


ok: [10.210.8.149] => {
    "msg": {
        "changed": true,
        "cmd": ". /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env\n 
val='v$archived_log'\n R=`sqlplus '/as sysdba' <<-EOF\n set numw 1 
lines 80 pages 0;\n select max(NEXT_CHANGE#) \"RMAN_SCN\" from $val 
where BACKUP_COUNT > 0;\n exit;\n EOF`\n echo $R",

        "delta": "0:00:01.031347",
        "end": "2018-02-28 10:15:49.032656",
        "failed": false,
        "rc": 0,
        "start": "2018-02-28 10:15:48.001309",
        "stderr": "/bin/bash: line 10: warning: here-document at line 
6 delimited by end-of-file (wanted `EOF')",

        "stderr_lines": [
            "/bin/bash: line 10: warning: here-document at line 6 
delimited by end-of-file (wanted `EOF')"

        ],
        "stdout": "SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 
28 10:15:48 2018 Copyright (c) 1982, 2014, Oracle. All rights 
reserved. ERROR: ORA-01017: invalid username/password; logon denied 
Enter user-name: SP2-0306: Invalid option. Usage: CONN[ECT] 
[{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] 
[edition=value]] where  ::= 
[/][@]  ::= 
[][/][@] Enter 
user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} 
[AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] 
where  ::= [/][@] 
 ::= 
[][/][@] SP2-0157: 
unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus",

        "stdout_lines": [
            "SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 28 
10:15:48 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. 
ERROR: ORA-01017: invalid username/password; logon denied Enter 
user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} 
[AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] 
where  ::= [/][@] 
 ::= 
[][/][@] Enter 
user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} 
[AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] 
where  ::= [/][@] 
 ::= 
[][/][@] SP2-0157: 
unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus"

        ]
    }
}


some one help me
--
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@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e31a47af-cc16-4fe0-ab75-80e9a58dfe13%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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/ec6a2643-701d-6c3c-936d-ea479d07452a%40lenhof.eu.org.


Re: [ansible-project] rpm--import issues

2020-05-06 Thread Jean-Yves LENHOF

Hi,

There's a module to import key, please use it !

https://docs.ansible.com/ansible/latest/modules/rpm_key_module.html

Regards,

JYL

Le 06/05/2020 à 12:17, Quad Zero a écrit :

Hi all,

Thank you for your help in my last post. I have come quite a way 
(small compared to many of you) but nevertheless making good progress 
each day.


I hit roadblocks quite a bit and thankfully google has helped me quite 
a bit. I have come across this problem now which I hope some of you 
can explain and then help me with finding a solution. This is my code 
so far:


---
- hosts: all
  serial: 3
  become: yes
  tasks:
    - name: ping all the machines
  ping:

    - name: Import all GPG keys for repo
  command: "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*"


When I am trying to run the rpm --import as a command, I get this 
error on my 3 test hosts:
1. What does it mean, why is this producing an error? I can enter this 
directly as a command in shell and it works just fine, so where is 
Ansible having issues?
2. How can I fix this and find a solution so that all my keys from the 
pki directory is imported as I have a mixture of RHEL and CentOS systems?


TASK [Import all GPG keys for repo] 
*
[WARNING]: Consider using the yum, dnf or zypper module rather than 
running 'rpm'.  If you need to use command because yum, dnf or
zypper is insufficient you can add 'warn: false' to this command task 
or set 'command_warnings=False' in ansible.cfg to get rid of this

message.
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["rpm", 
"--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": 
"0:00:00.029904", "end": "2020-05-06 05:08:49.909745", "msg": 
"non-zero return code", "rc": 1, "start": "2020-05-06 
05:08:49.879841", "stderr": "error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: 
import read failed(2).", "stderr_lines": ["error: 
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."], "stdout": 
"", "stdout_lines": []}
fatal: [testb_centos78]: FAILED! => {"changed": true, "cmd": ["rpm", 
"--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": 
"0:00:00.027775", "end": "2020-05-06 05:08:50.031696", "msg": 
"non-zero return code", "rc": 1, "start": "2020-05-06 
05:08:50.003921", "stderr": "error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: 
import read failed(2).", "stderr_lines": ["error: 
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."], "stdout": 
"", "stdout_lines": []}
fatal: [testa_centos78]: FAILED! => {"changed": true, "cmd": ["rpm", 
"--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": 
"0:00:00.027843", "end": "2020-05-06 05:08:50.035566", "msg": 
"non-zero return code", "rc": 1, "start": "2020-05-06 
05:08:50.007723", "stderr": "error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: 
import read failed(2).", "stderr_lines": ["error: 
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."], "stdout": 
"", "stdout_lines": []}


Thanks in advance everyone.
--
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/cf399d8a-bba9-49b8-afe9-6d07516eb99f%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/9d448094-60a4-27f9-32d6-5e6cad11af35%40lenhof.eu.org.


Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Jean-Yves LENHOF

Please as said by another people here, respect indentations stricly !

vmware_guest_info& name have not the same indentation as written by A. 
Kasurde


Regards,

JYL


Le 18/04/2020 à 22:14, Tony Wong a écrit :

this is the playbook

---
- name: get info vm
  hosts: localhost
  connection: local
  gather_facts: false
  tasks:
    - name: get info about the virtual machine
        vmware_guest_info:
          hostname: vcnerter
          username: administrator@vsphere.local
          password: 
          validate_certs: False
          name: myvm
          schema: "vsphere"
          properties: ["config.hardware.memoryMB", "guest.disk", 
"overallStatus"]

          datacenter: DC
          register: info

On Sat, Apr 18, 2020 at 1:11 PM Dick Visser > wrote:


That module was introduced in ansible 2.5:

https://docs.ansible.com/ansible/latest/modules/vmware_guest_powerstate_module.html

Do you run an older version?



On Sat, 18 Apr 2020 at 20:22, Tony Wong mailto:tdubb...@gmail.com>> wrote:

Hi

why is it when i run this playbook I get this error

tony@ubuntu:~/ansiblework$ ansible-playbook vmware_tools.yml
 [WARNING]: provided hosts list is empty, only localhost is
available. Note that the implicit localhost does not match 'all'

ERROR! no action detected in task. This often indicates a
misspelled module name, or incorrect module path.

The error appears to be in
'/home/tony/ansiblework/vmware_tools.yml': line 9, column 5,
but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
  - name: Get information about the virtual machine
    ^ here

-- 
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/201e9930-5b7d-432e-b801-d19070f1c81d%40googlegroups.com

.

-- 
Sent from a mobile device - please excuse the brevity, spelling

and punctuation.
-- 
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/CAL8fbwNCN3M5sh3H%3D4rFgO3d1TRXogadBjxd4CnyQCn%2BeG%3DANg%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/CALmkhkrJZNWzwge_XJFc_Qjac1epTEqvCZS%2BkDRCGDyEqMBNUw%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/7a8b6085-680e-646b-e670-832463387686%40lenhof.eu.org.


Re: [ansible-project] Task Status at Playbook runtime

2020-04-18 Thread Jean-Yves LENHOF

Hi,

Register a variable for the module you call and after test this variable...

More info here :

https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#rc

Example on a change (first link in google) :

https://raymii.org/s/tutorials/Ansible_-_Only-do-something-if-another-action-changed.html

Regards,

Le 18/04/2020 à 16:24, Ashish Sagar a écrit :

Hi Folks,

Is there anyway to get specific Task status like Changed, ignored or 
failed during Playbook runtime in synchronous mode ?



Thanks
Ashish
--
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/CADa6Y5abqHGma96mnx9VbXLwf-QZndxSPTanMrbXFObXKdUFRQ%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/29f68960-0c90-2885-15db-54d00c637a12%40lenhof.eu.org.


Re: [ansible-project] [HOSTVARS][MERGED] Unexpected behavior with merge variables of different host which are in several groups

2020-04-14 Thread Jean-Yves LENHOF

Hi,

As I understand etc_ip and postgresql_ip are variable specific for each 
host, and so they should be in hosts parts of your inventory file (Here 
you are doing a mix).


postgresql_existscan be setup in a your postgresql group, but I'm not 
sure if it is really necessary to have it


See there for example : 
https://docs.ansible.com/ansible/latest/plugins/inventory/yaml.html


If you want further help, please provide your playbooks used for your 
outputs.


And for the record, no needs to use a playbook to list variables, 
command "ansible-inventory" can be used successfully for this


Regards,

Le 14/04/2020 à 11:39, Baptiste Doublet a écrit :

Hi Everybody,

I have a problem that I can't resolve on my own.
I want to deploy an etcd cluster with postgresql on the same servers
I have three servers and this is my inventory file:

```
all:
children:
etcd_cluster: # recommendation: 3 or 5-7 nodes
hosts:
demo_postgres1:
vars:
etcd_ip: '***'
demo_postgres2:
vars:
etcd_ip: '***'
demo_postgres3:
vars:
etcd_ip: '***'
master:
hosts:
demo_postgres1:
vars:
postgres_ip: '***'
postgresql_exists: 'false'
replica:
hosts:
demo_postgres2:
vars:
postgres_ip: '***'
postgresql_exists: 'false'
demo_postgres3:
vars:
postgres_ip: '***'
postgresql_exists: 'false'
balancers:
hosts:
demo_haproxy1:
vars:
haproxy_ip: '***'
demo_haproxy2:
vars:
haproxy_ip: '***'
demo:
vars:
ansible_ssh_common_args: "-F ../../ssh_config/demo_config"
children:
balancers:
etcd_cluster:
postgres_cluster:
children:
master:
replica:
```
I have the demo_postgres[0-3] servers that run etcd and postgres. Just 
to prepare an external instance for etcd cluster, I have separated its 
in two distinct groups: etcd_cluster and postgres_cluster.

I have etcd_ip vars and postgres_ip varsrespectivelyon these groups.

My problem is when I run my playbook with hosts: etcd_cluster and I 
print hostvars, I get the hostvars of postgres_cluster:


```
PLAY [etcd_cluster] 
***


TASK [Gathering Facts] 


ok: [demo_postgres1]
ok: [demo_postgres3]
ok: [demo_postgres2]

TASK [Ansible | List all known variables and facts] 
***

ok: [demo_postgres1] => {
    "hostvars[inventory_hostname]['vars']": {
    "postgres_ip": "***",
    "postgresql_exists": "false"
    }
}
ok: [demo_postgres2] => {
    "hostvars[inventory_hostname]['vars']": {
    "postgres_ip": "***",
    "postgresql_exists": "false"
    }
}
ok: [demo_postgres3] => {
    "hostvars[inventory_hostname]['vars']": {
    "postgres_ip": "***",
    "postgresql_exists": "false"
    }
}

```
I didn't find any information about the merging of hostvars when the 
host is in multiple groups and when I have tested to remove the 
postgres_cluster group, I get the correct hostvars:


```
PLAY [etcd_cluster] 
***


TASK [Gathering Facts] 


ok: [demo_postgres1]
ok: [demo_postgres3]
ok: [demo_postgres2]

TASK [Ansible | List all known variables and facts] 
***

ok: [demo_postgres1] => {
    "hostvars[inventory_hostname]['vars']": {
    "etcd_ip": "***"
    }
}
ok: [demo_postgres2] => {
    "hostvars[inventory_hostname]['vars']": {
    "etcd_ip": "***"
    }
}
ok: [demo_postgres3] => {
    "hostvars[inventory_hostname]['vars']": {
    "etcd_ip": "***"
    }
}
```

I would expect that my etcd_ip was merged with postgres_ip ? I can 
resolve this by adding the etcd_ip in postgres_cluster hostvars but I 
want to understand why merge is not working.


If you need more information, feel free to ask.

Best regards,

BDO
--
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/d674a6d6-6640-4abb-ba52-51a5f2369692%40googlegroups.com 


Re: [ansible-project] custom facts - "msg": "[Errno 8] Exec format error: b'/etc/ansible/facts.d/custom.fact'", "rc": 8}},

2020-04-05 Thread Jean-Yves LENHOF

Hi,

Your fact is simple INI file, not a script which give json output.

Try removing the execution bit on your fact (644 for example)

Info provided here with some 2 mn googling :

https://groups.google.com/forum/#!topic/ansible-project/2JRR8a-K9_8

Regards,


Le 05/04/2020 à 08:22, Rajesh a écrit :

Tried that but still not working. Thanks for your help.

On Saturday, April 4, 2020 at 7:35:12 PM UTC+11, Jean-Yves LENHOF wrote:

The first time you run it, files are not yet in place, so you
probably need to regather fact, no ? You can do it with setup:

Regards,


Le 04/04/2020 à 10:18, Rajesh a écrit :

Could someone help why I am still getting the below error?

Thanks,
Rajesh

On Thursday, April 2, 2020 at 5:38:27 PM UTC+11, Rajesh wrote:

Thanks for that. I have modified the playbook as you
suggested. The playbook creates the custom file, but still
giving the below error.

[automation@workstation plays]$ cat facts.yml
- name: Create a custom facts file
  hosts: database
  become: true
  become_user: root
  gather_facts: true
  tasks:
    - name: Create a custom facts directory
  file:
    path: /etc/ansible/facts.d
    state: directory

    - name: Create a custom facts
  template:
    src: templates/custom.fact.j2
    dest: /etc/ansible/facts.d/custom.fact
    mode: 0755

    - name: Output our newly created static fact
  debug:
    msg: "{{ ansible_local.custom.sample_exam }}"
[automation@workstation plays]$

[automation@workstation plays]$ ansible-playbook facts.yml

PLAY [Create a custom facts file]

**

TASK [Gathering Facts]

*
ok: [ansible5]

TASK [Create a custom facts directory]

*
ok: [ansible5]

TASK [Create a custom facts]

***
changed: [ansible5]

TASK [Output our newly created static fact]


fatal: [ansible5]: FAILED! => {"msg": "The task includes an
option with an undefined variable. The error was: 'dict
object' has no attribute 'custom'\n\nThe error appears to be
in '/home/automation/plays/facts.yml': line 18, 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: Output our newly created static fact\n  ^ here\n"}

PLAY RECAP

*
ansible5   : ok=3    changed=1
unreachable=0    failed=1    skipped=0 rescued=0    ignored=0

[automation@workstation plays]$


On Thursday, April 2, 2020 at 4:46:20 PM UTC+11, Stefan
Hornburg (Racke) wrote:

On 4/2/20 4:16 AM, Rajesh wrote:
> Hi All,
>
> I created a custom facts playbook. But I am getting an
error when I run. I could not figure out why?

Hello Rajesh,

if /etc/ansible/facts.d/custom.fact is supposed to be a
script it needs executable permissions:

- name: Create a custom facts
  template:
    src: templates/custom.fact.j2
    dest: /etc/ansible/facts.d/custom.fact
    mode: 0755

Regards
         Racke

>
> *_Playbook_*
>
> - name: Create a custom facts file
>   hosts: database
>   become: true
>   become_user: root
  

Re: [ansible-project] custom facts - "msg": "[Errno 8] Exec format error: b'/etc/ansible/facts.d/custom.fact'", "rc": 8}},

2020-04-04 Thread Jean-Yves LENHOF
The first time you run it, files are not yet in place, so you probably 
need to regather fact, no ? You can do it with setup:


Regards,


Le 04/04/2020 à 10:18, Rajesh a écrit :

Could someone help why I am still getting the below error?

Thanks,
Rajesh

On Thursday, April 2, 2020 at 5:38:27 PM UTC+11, Rajesh wrote:

Thanks for that. I have modified the playbook as you suggested.
The playbook creates the custom file, but still giving the below
error.

[automation@workstation plays]$ cat facts.yml
- name: Create a custom facts file
  hosts: database
  become: true
  become_user: root
  gather_facts: true
  tasks:
    - name: Create a custom facts directory
  file:
    path: /etc/ansible/facts.d
    state: directory

    - name: Create a custom facts
  template:
    src: templates/custom.fact.j2
    dest: /etc/ansible/facts.d/custom.fact
    mode: 0755

    - name: Output our newly created static fact
  debug:
    msg: "{{ ansible_local.custom.sample_exam }}"
[automation@workstation plays]$

[automation@workstation plays]$ ansible-playbook facts.yml

PLAY [Create a custom facts file]

**

TASK [Gathering Facts]

*
ok: [ansible5]

TASK [Create a custom facts directory]

*
ok: [ansible5]

TASK [Create a custom facts]

***
changed: [ansible5]

TASK [Output our newly created static fact]


fatal: [ansible5]: FAILED! => {"msg": "The task includes an option
with an undefined variable. The error was: 'dict object' has no
attribute 'custom'\n\nThe error appears to be in
'/home/automation/plays/facts.yml': line 18, 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:
Output our newly created static fact\n  ^ here\n"}

PLAY RECAP

*
ansible5   : ok=3    changed=1 unreachable=0   
failed=1    skipped=0    rescued=0 ignored=0

[automation@workstation plays]$


On Thursday, April 2, 2020 at 4:46:20 PM UTC+11, Stefan Hornburg
(Racke) wrote:

On 4/2/20 4:16 AM, Rajesh wrote:
> Hi All,
>
> I created a custom facts playbook. But I am getting an error
when I run. I could not figure out why?

Hello Rajesh,

if /etc/ansible/facts.d/custom.fact is supposed to be a script
it needs executable permissions:

- name: Create a custom facts
  template:
    src: templates/custom.fact.j2
    dest: /etc/ansible/facts.d/custom.fact
    mode: 0755

Regards
         Racke

>
> *_Playbook_*
>
> - name: Create a custom facts file
>   hosts: database
>   become: true
>   become_user: root
>   gather_facts: true
>   tasks:
>     - name: Create a custom facts directory
>   file:
>     path: /etc/ansible/facts.d
>     state: directory
>
>     - name: Create a custom facts
>   template:
>     src: templates/custom.fact.j2
>     dest: /etc/ansible/facts.d/custom.fact
>
>     - name: Print ansible_local
>   debug: var=ansible_local
>     - name: Print the custom facts value
>   debug:
>     msg: "{{ ansible_local.custom.sample_exam }}"
>
> _*Template file*_
>
> [automation@workstation plays]$ cat templates/server_list.j2
> {% for host in groups['all'] %}
> {{ hostvars[host]['ansible_facts']['fqdn'] }}
> {% endfo

Re: [ansible-project] ansible nfsclient error

2020-03-29 Thread Jean-Yves LENHOF

Hi,

Message is somewhat explicit, please look a little bit by yourself 
before posting, your mount options are not good :


https://askubuntu.com/questions/786928/ubuntu-16-04-fstab-fails-with-nobootwait

Seems nobootwait isn't exist anymore, remove it or replace it with nofail

Regards,

JYL

Le 30/03/2020 à 08:36, sandy.h...@abagile.com a écrit :


Hi

 I change to   src: '192.168.1.146:/share'

Then change authority 600

It’s showmsg": "Error mounting nfs: mount.nfs: an incorrect mount 
option was specified\n"


BR

Sandy

*From:*ansible-project@googlegroups.com 
 *On Behalf Of *Jean-Yves LENHOF

*Sent:* Monday, March 30, 2020 2:20 PM
*To:* ansible-project@googlegroups.com
*Subject:* Re: [ansible-project] ansible nfsclient error

Hi,

Le 30/03/2020 à 08:15, Sandy Hung a écrit :

  src: '192.168.1.146/share'

should be :

  src: '192.168.1.146:/share'

Using 777 for rights is not a very good practice

Regards,

JYL

--
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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dabc0938-3462-6c8d-7b44-fed5e268f0eb%40lenhof.eu.org 
<https://groups.google.com/d/msgid/ansible-project/dabc0938-3462-6c8d-7b44-fed5e268f0eb%40lenhof.eu.org?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/011a01d6065d%248d9e8630%24a8db9290%24%40abagile.com 
<https://groups.google.com/d/msgid/ansible-project/011a01d6065d%248d9e8630%24a8db9290%24%40abagile.com?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6889ef0c-fde0-9847-08b9-93c6dae8aecd%40lenhof.eu.org.


Re: [ansible-project] ansible nfsclient error

2020-03-29 Thread Jean-Yves LENHOF

Hi,

Le 30/03/2020 à 08:15, Sandy Hung a écrit :

  src: '192.168.1.146/share'



should be :

  src: '192.168.1.146:/share'


Using 777 for rights is not a very good practice

Regards,

JYL

--
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/dabc0938-3462-6c8d-7b44-fed5e268f0eb%40lenhof.eu.org.


Re: [ansible-project] Re: expect and "Press to continue."

2020-03-27 Thread Jean-Yves LENHOF
I think 'Question' is not a parameter, it's the real question in the 
sample of ansible expect module


I think you could probably remove this line as you want only one answer 
to each question.


Regards,

Le 27/03/2020 à 11:18, Jost Rakovec a écrit :

Hi

is that possible to do with ansible or no one knows?

thanks



On Monday, March 23, 2020 at 9:48:37 PM UTC+1, Jost Rakovec wrote:

Hi

how can I use expect module to responds to  "Press  to
continue." during installation of software on linux?

The questins during installations are:

Press  to continue.  --> then show licence you have to go
to the last line with enter
If yes, enter ‘y’ to accept the license agreement. If no, enter
‘n’ to cancel the installation: y
VVAgent is still running. Do you wish to stop it? ([Y]/n) y
Installation directory? [/opt/BUAgent]
Select language: [en-US]
This will invalidate your previous registration. (y/[N]) N
Select option (A|B) (default A) A



- name: CV upgrade
  expect:
    command: "/root/evault/Agent-Linux-x64-8.63.7483/install.sh"
    responses:
  Question:
 - ''
 - y
 - y
 - /opt/BUAgent
 - en-US
 - N
 - A


in verbose mode I'm getting this:

    "start": "2020-03-23 21:40:15.642239",
    "stdout": "Verifying installer integrity... OK.\r\nVerifying
prerequisites... OK.\r\nInstall started at 21:40:16

2020.03.23\r\n\u001b[3;J\u001b[H\u001b[2J\r\nBefore
installing VVAgent, please read and agree to the terms\r\nand
conditions of its user

license.\r\n\r\nPress
 to continue.",
    "stdout_lines": [
    "Verifying installer integrity... OK.",
    "Verifying prerequisites... OK.",
    "Install started at 21:40:16 2020.03.23",
   

"\u001b[3;J\u001b[H\u001b[2J",

    "Before installing VVAgent, please read and agree to the
terms",
    "and conditions of its user license.",
   

"",

    "Press  to continue."



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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5feab149-3580-46c5-85cb-35409959c3f5%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/e5c48577-01f6-14d4-96cc-07f6e6c30f05%40lenhof.eu.org.


Re: [ansible-project] nfs client ansible

2020-03-27 Thread Jean-Yves LENHOF

Wrong argument :

sate --> state

Regards,


Le 27/03/2020 à 10:34, sandy.h...@abagile.com a écrit :


no

BR

Sandy

*From:*ansible-project@googlegroups.com 
 *On Behalf Of *Mark Whaite

*Sent:* Friday, March 27, 2020 5:16 PM
*To:* ansible-project@googlegroups.com
*Subject:* Re: [ansible-project] nfs client ansible

Hi

Are you missing a : from the src?

On Fri, 27 Mar 2020 at 09:08, Sandy Hung > wrote:


dear all:

fatal: [192.168.1.120]: FAILED! => {

    "changed": false,

"invocation": {

"module_args": {

"dump": "0",

"fstype": "nfs",

"opts": "defaults,nobootwait",

"passno": "2",

"path": "/nfs",

"sate": "mounted",

"src": "192.168.1.146/share/share "

        }

    },

    "msg": "Unsupported parameters for (mount) module: sate
Supported parameters include: backup, boot, dump, fstab, fstype,
opts, passno, path, src, state"

}

i don't know why unsupported mount module

my ansible

---

 - hosts: all

 gather_facts: no

   become: yes

   tasks:

     - name: Ensure NFS Common is installed

       apt: name=nfs-common update_cache=yes

     - name: Create mountable dir

       file: path=/nfs state=directory mode=777 owner=sandy
group=sandy

     - name: set mountpoints

       mount:

path=/nfs

          src=192.168.1.146/share/share


fstype=nfs

opts=defaults,nobootwait

dump=0

passno=2

sate=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/ea6594b2-fe17-4f2f-9f91-07df91dfcbe6%40googlegroups.com

.


--

Mark Whaite, Systems Administrator
Adelard LLP
Adelard LLP, Units 24 Waterside, 44-48 Wharf Road, London N1 7UX
Tel: 020 7832 5850
Web: http://www.adelard.com

This e-mail, and any attachments, is confidential and for the use of 
the addressee only. If you are not the intended recipient, please 
telephone 020 7832 5850. We do not accept legal responsibility for 
this e-mail or any viruses.


Registered office: Stourside Place, Station Road, Ashford, Kent TN12 1PP
Registered in England & Wales no. OC 304551. VAT no. 454 489808

--
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/CAHtMyqiR9v8HyZ0_by12yn6e-ja_mXayTQ-9u2OhKQbOu3UJ9g%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/012301d6041a%24f084e3b0%24d18eab10%24%40abagile.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/e9493fde-885e-b487-8840-6264ec8cef86%40lenhof.eu.org.


Re: [ansible-project] How to incorporate if else statement in Jinja template.

2020-03-06 Thread Jean-Yves LENHOF

Hi,

Your error is about a for loop, but your template included in your email 
doesn't have this loop.


Looks like you didn't give us the good one

Regards,

JYL


Le 06/03/2020 à 11:52, Shifa Shaikh a écrit :

Vladimir Hi,

I tried

|
{%if{{playbook_dir }}/{{item }}/bad*.txt |exists %}


{{item }}



{%else%}


{{item }}



{%endif %}

|

But I get this error:

|
TASK [Createthe Jinja2based 
template]*
fatal:[localhost]:FAILED!=>{"changed":false,"msg":"AnsibleError: 
template error while templating string: expected token ':', got '}'. 
String: {% for layer in layers %}\n

|




On Friday, March 6, 2020 at 3:36:04 PM UTC+5:30, Vladimir Botka wrote:

On Fri, 6 Mar 2020 01:59:00 -0800 (PST)
Shifa Shaikh > wrote:

> How do i  put the if /else condition in the jinja template ?

See "if"
https://jinja.palletsprojects.com/en/2.11.x/templates/#if



--
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/e2c31593-0389-4c5d-9bbb-9f29e528a832%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/44bc6389-53a2-31d9-62a4-25897191e902%40lenhof.eu.org.


Re: [ansible-project] Ansible output customize

2020-03-06 Thread Jean-Yves LENHOF

Hi,

Did you try a callback that satisfy you ?

https://docs.ansible.com/ansible/latest/plugins/callback.html

If not you should probably have to create yours...

Ansible is not the most obvious tool to create some reports... What did 
you want to achieve ? If you want a proper report, perhaps use a 
template to create what you want on destination nodes and after get 
files back to your controller with slurp module.


Regards,

JYL


Le 06/03/2020 à 06:51, Parveen Datt a écrit :

Hi JYL,

Here is what i mean.


TASK [debug] 
***


ok: [192.168.56.50] => (item= 00:48:30 up 2 min,1 user,load average: 
0.05, 0.06, 0.03) => {


"msg": " 00:48:30 up 2 min,1 user,load average: 0.05, 0.06, 0.03"

}

ok: [192.168.56.50] => (item=4.1.12-124.36.4.el7uek.x86_64) => {

"msg": "4.1.12-124.36.4.el7uek.x86_64"

}




Can we customize above output something like below

TASK [debug] 
***



"msg": "Server Uptime is -> [' 00:50:34 up 4 min,1 user,load average: 
0.01, 0.04, 0.03']"



"msg": "Server Kernel is --> ['4.1.12-124.36.4.el7uek.x86_64']"








On Tuesday, March 3, 2020 at 12:55:40 PM UTC-8, Jean-Yves LENHOF wrote:

Hi,

What is nicely formatted ?

Please show on an example what you want

Regards,

JYL

Le 03/03/2020 à 21:42, Parveen Datt a écrit :
> Hi Team
>
> I have written a playbook and using debug variable we are
reading the output in multiple play. Is there any way we can
customize the output of each registered variable and print it
nicely formatted . Any suggestion would be appreciated
>
> Thx
>

--
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 
<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a2a59ad5-fcea-4d84-8f09-ec954da750cf%40googlegroups.com 
<https://groups.google.com/d/msgid/ansible-project/a2a59ad5-fcea-4d84-8f09-ec954da750cf%40googlegroups.com?utm_medium=email&utm_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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/93ee30e9-1a34-5e89-695c-4a77292025a6%40lenhof.eu.org.


Re: [ansible-project] Ansible output customize

2020-03-03 Thread Jean-Yves LENHOF

Hi,

What is nicely formatted ?

Please show on an example what you want

Regards,

JYL

Le 03/03/2020 à 21:42, Parveen Datt a écrit :

Hi Team

I have written a playbook and using debug variable we are reading the output in 
multiple play. Is there any way we can customize the output of each registered 
variable and print it nicely formatted . Any suggestion would be appreciated

Thx



--
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/d6d038cd-def8-ab87-7dc6-bfc0ec153025%40lenhof.eu.org.


Re: [ansible-project] Re: How to get IP address from controller's /etc/hosts file?

2020-03-03 Thread Jean-Yves LENHOF

Hi,

Not read everything but first thing is that if you have a pipe in a 
command call you should use shell module instead... That should fix 
your first issue.


Regards,


JYL


Le 03/03/2020 à 21:42, Robert F a écrit :
Note that my awk command should say "print $1" to get the IP address. 
 I don't see a way to edit my original question here to make this change.


On Tuesday, March 3, 2020 at 12:38:38 PM UTC-8, Robert F wrote:

I'm trying to get the IP address of one of my remote hosts by
querying my controller machine's /etc/hosts file which happens to
contain the IP addresses of all the servers I build with Ansible.
 My Ansible playbook looks like this:

|
---
hosts:all
gather_facts:yes
become:yes


pre_tasks:
-name:getfile server's IP address
    command: "grep prod-fs1 /etc/hosts | awk '{print$0 }'"
    register: fs_ip_addr
    delegate_to: localhost


  - debug: var={{ fs_ip_addr }}
|


However, I'm getting this error which I don't know how to fix:

|
TASK [getfile server's IP address]

*
fatal: [prod-web1.example.com  ->
localhost]: FAILED! => {"changed": true, "cmd": ["grep",
"prod-fs1", "/etc/hosts", "|", "awk", "{ print $0 }"], "delta":
"0:00:00.010303", "end": "2020-03-03 12:24:36.207656", "msg":
"non-zero return code", "rc": 2, "start": "2020-03-03
12:24:36.197353", "stderr": "grep: |: No such file or
directory\ngrep: awk: No such file or directory\ngrep: { print $0
}: No such file or directory", "stderr_lines": ["grep: |: No such
file or directory", "grep: awk: No such file or directory", "grep:
{ print $0 }: No such file or directory"], "stdout":
"/etc/hosts:45.79.93.135 prod-fs1.example.com
    prod-fs1", "stdout_lines":
["/etc/hosts:45.79.93.135 prod-fs1.example.com
    prod-fs1"]}


PLAY RECAP

**
prod-web1.example.com  : ok=7  
 changed=0    unreachable=0    failed=1    skipped=0    rescued=0
   ignored=0;p
|

It appears that the error is caused by the pipe symbol which is
why I enclosed the entire command in double quotes.  But the error
occurs even if I remove them.

I should add that I know I could use this method of getting the IP
address of my file server...

|
-name:getfile server's IP address
     set_fact:

fs_ip_addr=hostvars[groups['fileservers'][0]]['ansible_eth0']['ipv4']['address']
|

However, this option isn't available to me since I have to call
the playbook with the "limit" argument which cause the variable to
not be available.

|
deploy-webservers.yml -I inventory -l webservers
|

--
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/21a85286-91fb-404c-a9d5-f30608be1c3d%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/d5a585c3-8242-7898-daf7-ae94f70fa413%40lenhof.eu.org.


Re: [ansible-project] variable undefined?

2020-02-29 Thread Jean-Yves LENHOF

Hi,

Variable are for a host You use "localhost" and "staging"

unless the group staging contains only localhost, yes you will have some 
undefined variable for the different hosts in your staging group


Regards,

JYL


Le 29/02/2020 à 09:48, Dave York a écrit :
I'm confused why I'm getting a 'variable undefined' error with this 
playbook, anyone have any idea?


- hosts: localhost
connection: local
gather_facts: yes

tasks:
  - name: 
Generate a temporary random password for template/os customization

set_fact:
randopass: 
"{{ lookup('password', '/dev/null length=24 chars=ascii_letters') }}"
... I use '{{ randopass }}' somewhere else in this play and its 
fine... but then I get to this part:

- hosts: staging
vars:
ansible_user: Administrator
ansible_password: '{{ randopass }}'
gather_facts: yes
ERROR:
The field 'password' has an invalid value, which includes an undefined 
variable. The error was: 'randopass' 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/1a0e91d7-88fe-4d3f-96b4-115de45f29f6%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/b6a93682-90fd-79bf-15d7-d7687000e3d6%40lenhof.eu.org.


Re: [ansible-project] [ Ansible ] - Weird nested loop help

2020-02-24 Thread Jean-Yves LENHOF

Not so obvious to understand...

Perhaps you should try progressive steps and not wanting to do 
everything in one unique step


To look for specific file, perhaps you should use the find module with a 
register


And after loop on these files using the variable registered before...

Regards,


Le 24/02/2020 à 14:00, João Santos a écrit :

Hey community, need your help again...

On my goal of automation I'm blocked on loops... dont know if I'm 
doing wrong, need to change approach or if just stupid...


Well, lets try...

I would like to replace lines in FILES_A with lines that are on MAPPING_A.

|
  - name: Add values from MAPPING_A to FILES_A
    lineinfile:
      path: "/PATH_TO/*FILES_A*/{{ item.0 | basename }}"
      line: "{{ item.1 }}"
      insertafter: "^(.*){{ item.1.split('=') | first }}"
    with_nested:
      - "{{ lookup('fileglob', '/PATH_TO/*MAPPING_A*/*.TXT') }}"
      - "{{ lookup('file', '/PATH_TO/*MAPPING_A*/{{ item.0 | basename 
}}.TXT').splitlines() | select() | list }}"

|

Allow me to give more insight of what I want to achieve with that loop:

|
"{{ lookup('fileglob', '/PATH_TO/*MAPPING_A*/*.TXT') }}"
|

^^ want to list all files on that folder, because I will need to 
collect /filename/**/- //_thats the reason why i have_ "//{{ item.0 | 
basename }}" /_at _*path* - that would be what I use to identify which 
files I want to change.
If files exists in that folder will contain content to replace on a 
diferent destination and filename is what I'm using. If filename 
exists on both sides will collect content and insert it.

so that will be the first loop

|
"{{ lookup('file', '/PATH_TO/*MAPPING_A*/{{ item.0 | basename 
}}.TXT').splitlines() | select() | list }}"

|

^^ Ok, after the first loop is in place (list of which files to edit), 
now on the second loop I need to /per file/ to read content in order 
to replace on the destination.



Screenshot 2020-02-24 at 12.55.04.png




What is happening?
Maybe its not supposed to... Ansible is not recognizing "{{ item.0 | 
basename }}" at second loop



Well... ¯\_(ツ)_/¯ again... I'm stuck, can anyone share 
thoughts/suggestions with me?

--
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/e9220677-c1a0-4d7f-bf07-336e62ec1be7%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/6302aa8a-ff56-c217-9ddf-e389456bea1f%40lenhof.eu.org.


Re: [ansible-project] shell module failing for grep

2020-02-22 Thread Jean-Yves LENHOF

Hi,

Did you submit the shell command with the same user ?

Regards,

Le 21/02/2020 à 21:31, Matt Zagrabelny a écrit :

Greetings,

I'm running ansible 2.9 (2.9.4+dfsg-1) and I've searched the mailing
list archives regarding this issue, but I haven't found out why I'm
seeing what I am seeing.

shell module is failing when I'm not expecting it to.

I run this command manually on my system:

$ dconf dump /org/mate/desktop/keybindings/ | grep "action='chromium'"
action='chromium'

but in ansible:

- name: get dconf desktop/keybindings for chromium
   shell: dconf dump /org/mate/desktop/keybindings/ | grep "action='chromium'"
   register: dconf_desktop_keybindings
   ignore_errors: True

and the output:

fatal: [zipper]: FAILED! => {"changed": true, "cmd": "dconf dump
/org/mate/desktop/keybindings/ | grep \"action='chromium'\"", "delta":
"0:00:00.005304", "end": "2020-02-21 14:24:31.441719", "msg":
"non-zero return code", "rc": 1, "start": "2020-02-21 14
:24:31.436415", "stderr": "", "stderr_lines": [], "stdout": "",
"stdout_lines": []}

Any ideas why it is failing?

Thanks for any help!

-m



--
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/9a682b62-c988-cc7d-7002-216097170bb7%40lenhof.eu.org.


Re: [ansible-project] Playbook doesn't run completely stuck after "check if reboot required"

2020-02-12 Thread Jean-Yves LENHOF
Why not using the "reboot" module which is done for that instead of 
using shell module with some tricks ?


Regards,


JYL


Le 12/02/2020 à 19:30, Work-Hard a écrit :
*Playbook doesn't run completely stuck after "check if reboot 
required". Please assist!*

*
*
*
Play-Book*
---
- hosts: ubuntu
  become: true
  any_errors_fatal: true
  serial: 1
  max_fail_percentage: 0
  vars:
    ansible_user: ubuntu
  tasks:
    # do an "apt-get update", to ensure latest package lists
    - name: apt-get update
      apt:
        update-cache: yes
      changed_when: 0

    # get a list of packages that have updates
    - name: get list of pending upgrades
      command: apt-get --simulate dist-upgrade
      args:
        warn: false # don't warn us about apt having its own plugin
      register: apt_simulate
      changed_when: 0

    - name: Update cache
      apt:
        update-cache: yes
      changed_when: false

    - name: Fetch package list of updates
      command: apt list --upgradable
      register: aptlist
    - set_fact:
        updates: "{{ aptlist.stdout_lines | difference(['Listing...'])
| map('regex_replace', '^(.*?)/(.*)', '\\1') | list }}"

    - debug: var=updates

    # tell user about packages being updated
    - name: show pending updates
      debug:
        var: updates
      when: updates.0 is defined

    # running package ack each server update with a prompt
    - pause:
      when: updates.0 is defined

    # if a new kernel is incoming, remove old ones to avoid full /boot
    - name: apt-get autoremove
      command: apt-get -y autoremove
      args:
        warn: false
      when: '"Inst linux-image-" in apt_simulate.stdout'
      changed_when: 0

    # do the actual apt-get dist-upgrade
    - name: apt-get dist-upgrade
      apt:
        upgrade: dist # upgrade all packages to latest version
      register: upgrade_output

    # check if we need a reboot
    - name: check if reboot needed
      stat: path=/var/run/reboot-required
      register: file_reboot_required

    # "meta: end_play" aborts the rest of the tasks in the current 
«tasks:»

    # section, for the current desired server
    - meta: end_play
      when: not file_reboot_required.stat.exists

    # because of the above meta/when we at this point know that the 
current

    # host needs a reboot

    # prompt for manual input before doing the actual reboot
    - name: Confirm reboot of ubuntu
      pause:

    - name: reboot node
      shell: sleep 2 && shutdown -r now "Reboot triggered by ansible"
      async: 1
      poll: 0
      ignore_errors: true

    # poll ssh port until we get a tcp connect
    - name: wait for node to finish booting
      become: false
      local_action: wait_for host=ubuntu
          port=22
          state=started
          delay=5
          timeout=600

    # give sshd time to start fully
    - name: wait for ssh to start fully
      pause:
        seconds: 15

    # wait a few minutes between hosts, unless we're on the last
    - name: waiting between hosts
      pause:
        minutes: 10
      when: inventory_hostname != ansible_play_hosts[-1]

*Output*
PLAY [ubuntu] 



TASK [Gathering Facts] 
***

ok: [10.0.2.236]

TASK [apt-get update] 


ok: [10.0.2.236]

TASK [get list of pending upgrades] 
**

ok: [10.0.2.236]

TASK [Update cache] 
**

ok: [10.0.2.236]

TASK [Fetch package list of updates] 
*

changed: [10.0.2.236]

TASK [set_fact] 
**

ok: [10.0.2.236]

TASK [debug] 
*

ok: [10.0.2.236] => {
    "updates": []
}

TASK [show pending updates] 
**

skipping: [10.0.2.236]

TASK [pause] 
*

skipping: [10.0.2.236]

TASK [apt-get autoremove] 

Re: [ansible-project] What is the best approach to creating a inlude_vars file for my requirement

2020-01-28 Thread Jean-Yves LENHOF



Le 28/01/2020 à 22:13, Stefan Hornburg (Racke) a écrit :

On 1/26/20 3:11 PM, Shifa Shaikh wrote:

Dick Hi,

My requirement is not about configuring a webserver.

It is to maintain a check on a set of files. If the file changes by checksum or 
permissions I wish to trigger an alert.

Thus, my ansible will stat the file and then compare the checksum and mode that 
was previously stored in the
include_vars file.

If they match we are good else we will trigger an alert.

Thus, I want to understand if my approach/format of storing mode and checksum 
information for all files on all servers
good? if not please propose how should i design the include_vars files so I 
could read the checksum and mode of a file
on a  particular IP.

Why don't use an existing checksum tool (e.g Google for linux ids checksum 
tools) ?

Regards
  Racke


Hi,

As said by Racke, why not using a tool designed for it like these (there 
are available for other distro) : https://doc.ubuntu-fr.org/rootkit


Another way to make some controls is to use package tools with some 
options


dpkg --verify or rpm -Va can be interesting to use


Regards,


JYL

--
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/da22d9b3-9b6a-c333-bd3b-3bc18c4f2778%40lenhof.eu.org.


Re: [ansible-project] Basic beginner question

2020-01-26 Thread Jean-Yves LENHOF

Hi,

You probably looking for ansible_os_family which is RedHat for these 
distributions : RedHat EL, CentOS, Amazon, etc...


You should probably test the major version (between 6 and 7, there's 
service and systemctl which are kind different for example, I suppose 
you're not modifying only ssh config)


So you're when directive should be something like this :

when: ansible_os_family == 'RedHat' and 
ansible_distribution_major_version in ['6','7']


Regards,

Le 26/01/2020 à 13:50, Waqar Khan a écrit :
Starting out with ansible and trying to configure sshd config. Here is 
what I have, it works but is there a better way to do with for future 
reference. e.g. if I have many different distributions it looks like a 
lot of copying. Can I combine the 2 tasks?


- name: sshd Amazon
lineinfile:
state: present
path: /etc/ssh/sshd_config
regexp: "^AllowUsers"
line: AllowUsers ec2-user
when: ansible_distribution == 'Amazon'
notify:
- restart sshd
- name: sshd Centos
lineinfile:
state: present
path: /etc/ssh/sshd_config
regexp: "^AllowUsers"
line: AllowUsers centos
when: ansible_distribution == 'Centos'
notify:
- restart sshd
--
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/fc08397d-3bb8-4087-93f2-9a4d85378906%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/7318ce4d-08ad-00da-fc54-3fd495944775%40lenhof.eu.org.


Re: [ansible-project] Hostvars giving me undefined error

2020-01-24 Thread Jean-Yves LENHOF

Hi,

You should better use the find module instead of shell module and ls.

As said, yum seem to be a group... To use hostvars special variable you 
need to use host and not group...


Something like this will work :

msg: "{{ hostvars['YUM01']['some_value'] }}"


But instead of asking to remove your error, perhaps you could explain 
what you want to do...


Regards,

JYL


Le 24/01/2020 à 17:49, Rakesh Parida a écrit :

Hi

Iam trying to access the variable from other hosts using hostvars. I 
am getting the undefined error.

Can anybody help me: stuck at this point



- hosts: yum
  gather_facts: false
  vars:
     file_locn: "/san/repos/{{ version }}/packages"
  tasks:
    - name: Find the Packages that are present in File location
      shell: ls -lrt {{ file_locn }} |awk 'NR>1{print $9}'|grep -i rpm
      register: files_present

    - name: Set Fact
      set_fact:
         some_value: "{{ files_present.stdout_lines }}"

    - debug:
        msg: "{{ some_value }}"

- hosts: localhost
  gather_facts: false
  tasks:
    - name: Show hostvars
      debug:
        msg: "{{ hostvars['yum']['some_value'] }}"

error:
PLAY [yum] 
***


TASK [Find the Packages that are present in File location] 
***

changed: [YUM01]

TASK [Set Fact] 
**

ok: [YUM01]

TASK [debug] 
*

ok: [YUM01] => {
    "msg": [
        "common-3.0.12.rpm",
    ]
}

PLAY [localhost] 
*


TASK [Show hostvars] 
*
fatal: [localhost]: FAILED! => {"msg": "The task includes an option 
with an undefined variable. The error was: \"hostvars['yum']\" is 
undefined\n\nThe error appears to be in '/home/rparida1/raka.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 
tasks:\n    - name: Show hostvars\n      ^ here\n"}


PLAY RECAP 
***
YUM01                   : ok=3    changed=1 unreachable=0    failed=0  
  skipped=0    rescued=0 ignored=0
localhost                  : ok=0    changed=0 unreachable=0    
failed=1    skipped=0    rescued=0 ignored=0

--
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/f6ce73ce-1ef3-455a-9153-f52380c7b56d%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/ccda6477-ddea-79ee-60b0-2c5cbac511d4%40lenhof.eu.org.


Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Jean-Yves LENHOF
Not undestanding exactly what you want to achieve... 

For the syntax error you forgot a quote
So instead of this

target: "{{ input | regex_replace('\\sSSLFile.*, '\\1') }}"
You need this
target: "{{ input | regex_replace('\\sSSLFile.*' , '\\1') }}"

Regards, 

Le 15 janvier 2020 08:59:32 GMT+01:00, Shifa Shaikh  a 
écrit :
>Reading the contents of the file is not the challenge. I used both
>sllurp 
>as well as cat and I can see the file contents in the debug. The error 
>occurs when I regex for the desired string. 
>
>- name: Slurp certificate entries
>  slurp:
>src: "{{ httpd_home }}/conf/httpd.conf"
>  register: filecontent
>
>- name: Find certificate entries
>  set_fact:
>input: "{{ filecontent['content'] | b64decode }}"
>
>- debug:
>msg: "{{ input }}"
>
>- name: Regex String
>  set_fact:
>target: "{{ input | regex_replace('\\sSSLFile.*, '\\1') }}"
>
>
>The regex task fails where we are assigning the set_fact "target" with
>the 
>below error:
>
>TASK [Regex String] ***
>>
>> *task path: /app/test.yml:908*The full traceback is:
>> Traceback (most recent call last):
>> File
>"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", 
>> line 144, in run
>> res = self._execute()
>> File
>"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", 
>> line 576, in _execute
>> self._task.post_validate(templar=templar)
>> File "/usr/lib/python2.7/site-packages/ansible/playbook/task.py",
>line 
>> 268, in post_validate
>> super(Task, self).post_validate(templar)
>> File "/usr/lib/python2.7/site-packages/ansible/playbook/base.py",
>line 
>> 384, in post_validate
>> value = templar.template(getattr(self, name))
>> File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py",
>line 
>> 584, in template
>> disable_lookups=disable_lookups,
>> File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py",
>line 
>> 539, in template
>> disable_lookups=disable_lookups,
>> File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py",
>line 
>> 773, in do_template
>> data = _escape_backslashes(data, myenv)
>> File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py",
>line 
>> 145, in _escape_backslashes
>> for token in jinja_env.lex(d2):
>> File "/usr/lib/python2.7/site-packages/jinja2/lexer.py", line 733, in
>
>> tokeniter
>> name, filename)
>> TemplateSyntaxError: unexpected char u'\\' at 51
>> line 1 fatal: [10.9.9.11]: FAILED! => {
>> "msg": "Unexpected failure during module execution.", 
>> "stdout": ""
>> }
>
>
>On Wednesday, January 15, 2020 at 12:04:52 PM UTC+5:30, Jean-Yves
>LENHOF 
>wrote:
>>
>> Hi,
>>
>> Perhaps you should better use slurp module to register the content of
>the 
>> file and do some regexp to print what you want on it...
>>
>>
>>
>https://docs.ansible.com/ansible/latest/modules/slurp_module.html#slurp-module
>>
>> Regards,
>>
>>
>> Le 15/01/2020 à 06:34, Shifa Shaikh a écrit :
>>
>> I wish to search for all entries of string starting with "SSLFile" or
>
>> starting with "SSLFile" in a file(httpd.conf) and
>register 
>> it to a variable and print all the matches found.  
>>
>> The string is found as evident from the output and the file is not 
>> modified which is good; but I'm unable to print (debug) it. I get
>error as 
>> I try to print. Below is my playbook: 
>>
>> - name: Find entries
>>   lineinfile:
>> path: "/tmp/httpd.conf"
>> regexp: "\\sSSLFile.*"
>> state: absent
>>   check_mode: yes
>>   changed_when: false
>>   register: filedet
>>
>> - debug:
>> msg: "{{ filedet }}"
>>
>> - debug:
>> msg: "{{ item.split()[1] }}"
>>   with_items:
>> - "{{ filedet.stdout_lines }}"
>>
>> I get the below error when i run the playbook:
>>
>>
>> ok: [10.9.9.11] => {
>>> "backup": "", 
>>> "changed": false, 
>>> "diff": [
>>>

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-14 Thread Jean-Yves LENHOF

Hi,

Perhaps you should better use slurp module to register the content of 
the file and do some regexp to print what you want on it...


https://docs.ansible.com/ansible/latest/modules/slurp_module.html#slurp-module

Regards,


Le 15/01/2020 à 06:34, Shifa Shaikh a écrit :
I wish to search for all entries of string starting with "SSLFile" or 
starting with"SSLFile" in a file(httpd.conf) and register 
it to a variable and print all the matches found.


The string is found as evident from the output and the file is not 
modified which is good; but I'm unable to print (debug) it. I get 
error as I try to print. Below is my playbook:


|
-name:Findentries
      lineinfile:
        path:"/tmp/httpd.conf"
        regexp:"\\sSSLFile.*"
        state:absent
      check_mode:yes
      changed_when:false
register:filedet

    - debug:
        msg: "{{ filedet }}"

-debug:
        msg:"{{ item.split()[1] }}"
      with_items:
-"{{ filedet.stdout_lines }}"
|

I get the below error when i run the playbook:


ok: [10.9.9.11] => {
"backup": "",
"changed": false,
"diff": [
{
"after": "",
"after_header": "/tmp/httpd.conf (content)",
"before": "",
"before_header": "/tmp/httpd.conf (content)"
},
{
"after_header": "/tmp/httpd.conf (file attributes)",
"before_header": "/tmp/httpd.conf (file attributes)"
}
],
"found": 1,
"invocation": {
"module_args": {
"attributes": null,
"backrefs": false,
"backup": false,
"content": null,
"create": false,
"delimiter": null,
"directory_mode": null,
"firstmatch": false,
"follow": false,
"force": null,
"group": null,
"insertafter": null,
"insertbefore": null,
"line": null,
"mode": null,
"owner": null,
"path": "/tmp/httpd.conf",
"regexp": "\\sSSLFile.*",
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "absent",
"unsafe_writes": null,
"validate": null
}
},
"msg": "1 line(s) removed"
} TASK [debug]
***
*task path: /app/test.yml:924
*ok: [10.9.9.11] => {
"msg": {
"backup": "",
"changed": false,
"diff": [
{
"after": "",
"after_header": "/tmp/httpd.conf (content)",
"before": "",
"before_header": "/tmp/httpd.conf (content)"
},
{
"after_header": "/tmp/httpd.conf (file attributes)",
"before_header": "/tmp/httpd.conf (file attributes)"
}
],
"failed": false,
"found": 1,
"msg": "1 line(s) removed"
}
} TASK [debug]
***
*task path: /app/test.yml:928
*fatal: [10.9.9.11]: FAILED! => {
"msg": "'dict object' has no attribute 'stdout_lines'"
}

Can you please suggest what is the correct way to print all the 
searched matched strings without modifying the file ? I wish to use 
the the registered variable to perform other actions later in the 
playbook.

--
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/47deda2a-1a8c-4387-9a5b-d2ea548ad752%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/82efc325-730b-bd86-9a11-8ead9a5d8713%40lenhof.eu.org.


Re: [ansible-project] Gathering Facts hangs when using become

2020-01-13 Thread Jean-Yves LENHOF
Hi, 

Problems I already encounter :
- NFS Stale
- rpm database corruption
- lock on lvm

Regards,

Jy

Le 14 janvier 2020 00:46:56 GMT+01:00, Chris Thro  a 
écrit :
>Out of hundreds of hosts we have one host always hangs when gathering
>facts 
>when using become.
>
>Create a playbook with the following:
>- hosts: all
>
>call the playbook with the -b flag
>
>The last thing reported in the log is "Escalation succeeded".  
>No matter how long I wait it never returns the prompt and there are two
>
>processes running on the remote host. One as my username and one as
>root.
>
>There is no nfs (I have seen other issues where facts hang on nfs).
>
>This is a RHEL5 host with python 2.7 installed.  1/4 of our hosts are
>RHEL5 
>with python 2.7 installed and they don't have this issue
>
>Anyone see this before? Any ideas how to troubleshoot it further?
>I have tried the highest verbosity but there doesn't appear to be any 
>helpful information; compared it to successful runs and nothing is 
>different.
>
>-- 
>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/8a8e3f63-3d6f-4d5b-b2df-3de89a780021%40googlegroups.com.

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.

-- 
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/70D944C5-478F-4D5E-B04E-27CC1948E40D%40lenhof.eu.org.


Re: [ansible-project] Why doesn't this task to check when a server has booted work?

2020-01-07 Thread Jean-Yves LENHOF



Le 07/01/2020 à 22:55, RobertF a écrit :
I have an Ansible playbook for creating [Linode](https://linode.com) 
servers.  The problem I'm having is that my playbook isn't able to 
determine when the new server is up.  I'm using Ansible 2.8.4.  My 
playbook is as follows:


    ---
    hosts: 127.0.0.1
    gather_facts: False

    - name: create server
      linode_v4:
        label: "{{ host_name }}_{{ 100 | random }}"
        access_token: "{{ linode_api4_key }}"
        type: "{{ plan_1GB }}"
        region: "{{ region_us_central }}"
        image: "{{ image_debian_10 }}"
        root_pass: "{{ linode_root_password }}"
        authorized_keys: "{{ my_ssh_public_key }}"
        tags: "inventory.ini"
        state: present
      register: linode

    - name: save new server's ip address to a fact
      set_fact: ip_addr={{ linode.instance.ipv4 }}
      tags: always

    - debug:
        var: ip_addr

    - name: wait until new server is up
      wait_for:
        state: started
        host: "{{ ip_addr }}"
        port: 22
        delay: 2
        timeout: 600
        msg: "Server port is not listening"
      tags: always

I also tried it this way:

    - name: wait until new server is up
      local_action:
        module: wait_for
        state: started
        host: "{{ ip_addr }}"
        port: 22
        delay: 1
        timeout: 100


I've tried doing it using a wait_for and also via local_action but 
neither one is working.  The playbook never returns from the wait for 
task.  I monitor my Linode dashboard as the playbook runs and I can 
see that that IP address I'm feeding to the task via "ip_addr" is 
correct and the dashboard also shows me when the server is up.  Can 
anyone see what I doing wrong?  Thanks!


Hi,

You should probably use "wait_for_connection" module instead of the one 
you use


This is how I use it :

- hosts: newly_managed_vms
  become: yes
  become_user: root
  remote_user: ansible
  gather_facts: no   # servers could be not available yet
  tasks:

  - name: "Wait for server to power up"
    wait_for_connection:
  sleep: 5
  timeout: 600

  - name: "Gather facts for first time"
    setup:

Regards,

JYL

--
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/0091146e-b85a-4251-f95f-d5ff943d7e0f%40lenhof.eu.org.


Re: [ansible-project] Need help on building ansible inventory file properly

2019-12-30 Thread Jean-Yves LENHOF

Hi,

It's difficult to understand what you want to do... Perhaps you should 
explain in plain english before trying to code it ?


In your code, there's a "hosts" directive in your inventory You 
should not have it in this file ("hosts" directive is for playbooks)


If you have multiple inventory, perhaps a way to select which inventory 
to select is to add an argument to your running playbook


ansible-playbook -i /home/ansible/MACCABI/hosts/POC_ENV.yml myplaybook.yml


Regards,

Le 30/12/2019 à 11:07, Yehuda Pinhas a écrit :


Hi,

Can you please take a look on my errors and try to help me figuring 
out why I am getting them?


This is my inventory code:
  - hosts: localhost
vars:
my_hosts:
- group: 'POC_ENV'
hosts: "{{ lookup('file',
 '/home/ansible/MACCABI/hosts/POC_ENV.yml').splitlines() }}"
vars:
ansible_ssh_private_key_file: /home/ansible/.ssh/id_rsa
ansible_ssh_common_args: 
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

ansible_user: ansible

This is my playbook code (task is to add a VLAN):
name: Playing VLAN Configuration
hosts: POC-ENV
connection: local
vars:
vlan_id: 999
vlan_name: TEST_VLAN_TEST
tasks:
- include_role:
name: add_vlan
name: show_vlan


This is the errors I get:

Ansible add vlans errors.PNG


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-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/512c2e73-247b-400c-a6d9-fe5afb947d1f%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/fea3d260-f83b-8fd5-d60a-337564363f13%40lenhof.eu.org.


Re: [ansible-project] Besoin d'aide pour Upgrade ansible

2019-12-12 Thread Jean-Yves LENHOF



Hi,

You should ask your questions in English instead of French on such 
group.

(You ask about some help to upgrade ansible from 2.7 to 2.9)

Before answering, what's your OS Controller ? What's your version ?
Is the version 2.7 installed by RPM, by dpkg, by pip, with virtualenv ?

Regards,

JYL


Le 2019-12-12 16:15, krad imen a écrit :

Bonjour;

Pouvez vous m'aider pour faire la mise à jour d'ansible de 2.7 vers
2.9 svp. je n'ai pas trouver la procédure détaillée pour le faire.

Merci par avance




--
Jean-Yves LENHOF
jean-y...@lenhof.eu.org
Tel: 06 50 95 41 26

--
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/e618b725ade55c66445f730d207476f8%40lenhof.eu.org.


Re: [ansible-project] Ansible seems not supporting fundemental user management commands in Arch Linux

2019-11-22 Thread Jean-Yves LENHOF

Hi,

You did a mix between the user module and the group module parameters.

Please read docs and samples :

https://docs.ansible.com/ansible/latest/modules/group_module.html

https://docs.ansible.com/ansible/latest/modules/user_module.html


I think you should made a loop around group module to ensure all wanted 
groups exist,


and a second loop around user module to create users you want

Regards,

JYL


Le 22/11/2019 à 23:23, Bilinmek Istemiyor a écrit :

Thank you for the response.

I have extracted some private information but the playbook is a follows...

- hosts: nas
  remote_user: root
  tasks:
  - name: create users
    group:
  name: "{{ item.name }}"
  comment: "{{ item.comment }}"
  shell: "{{ item.shell }}"
  home: "{{ item.home }}"
  group: "{{ item.name }}"
  groups: "{{ item.groups }}"
  append: yes
    loop:
    - { name: 'user1', comment: 'User1 Information', shell: 
'/user/bin/bash',    home: '/pool/home/user1', groups: 
'group1,group2,group3,group4,group5,group6'}
    - { name: 'user2', comment: 'User2 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user2', groups: 
'group1,group2,group3,group4,group5,group6'}
    - { name: 'user3', comment: 'User3 Information', shell: 
'/user/bin/nologin', home: '/pool/home/user3', groups: 
'group1,group2,group3,group4,group5,group6'}





On Saturday, November 23, 2019 at 12:49:38 AM UTC+3, alicia wrote:

Can you add the playbook you’re running? The error message alone
only gets us so far.

The error message is telling you that a task using the group
module cannot include all the parameters you’re passing to it.
Take a look at
http://docs.testing.ansible.com/ansible/devel/modules/group_module.html
 
for
detailed documentation on how to use the group module and the
parameters it accepts.

Hope this helps,
Alicia


On Nov 22, 2019, at 3:41 PM, Bilinmek Istemiyor
> wrote:

Hello,

I am building a nas server with manjaro architect (arch based
distribution). I try to automate tasks with ansible. However
ansible user management is giving me errors stating that ""msg":
"Unsupported parameters for (group) module: append, comment,
group, groups, home, shell Supported parameters include: gid,
local, name, non_unique, state, system"} "

However to the best of my knowledge command set is the same with
debian, ubuntu etc.  The not supported parameters are crucial for
account management since I use lots of custom groups and custom
home folder paths along with shell option.

I believe ansible detect the environment as follows

    "ansible_distribution": "Archlinux",
    "ansible_distribution_file_path": "/etc/arch-release",
    "ansible_distribution_file_variety": "Archlinux",
    "ansible_distribution_major_version": "18",
    "ansible_distribution_release": "Juhraya",
    "ansible_distribution_version": "18.1.3",

Any help much appreciated



-- 
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/d3c57d1d-c116-4e18-a448-38ada9ec65e6%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/cbbbdfe8-4a10-4f93-b9e2-5326d58c513e%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/c8a26db6-0d7c-c0a8-8639-7acb17ec3392%40lenhof.eu.org.


Re: [ansible-project] Ansible Version Migration

2019-11-21 Thread Jean-Yves LENHOF

Le 2019-11-21 15:02, Vladimir Botka a écrit :

On Thu, 21 Nov 2019 05:01:31 -0800 (PST)
deva raju  wrote:

Now, we would like to move to either ansible-2.4 or ansible-2.5 So, 
what is

the way to migrate my code to latest version ? Or do i need write the
complete code from scratch ?


The answers are in the Porting guides.
https://docs.ansible.com/ansible/latest/porting_guides/

Cheers,

-vlado



Usualy compatibility is quite good...
When going from 1.9 to 2.1, I had quite some porting code to do
From now, change between version is generally deprecated before being 
obsoleted.


So expect some work for your very old scripts using version 1.5...

Regards,


--
--
Jean-Yves LENHOF
jean-y...@lenhof.eu.org
Tel: 06 50 95 41 26

--
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/5929578ef56022131fd91074b4a5735e%40lenhof.eu.org.


Re: [ansible-project] Running ansible playbook with different versions

2019-11-11 Thread Jean-Yves LENHOF
The keyword you are looking into is python virtualenv. 

Regards, 

Le 12 novembre 2019 07:20:44 GMT+01:00, Ganesh Biradar 
 a écrit :
>Is there any way to run different playbooks in the same directory with 
>different ansible versions using the ansible-playbook command?
>
>-- 
>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/c43de100-dc3b-4089-a394-c8c723b8ce99%40googlegroups.com.

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.

-- 
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/50AA943D-BBD3-4245-95C4-4F13CE25725C%40lenhof.eu.org.


Re: [ansible-project] When ansible supports rhel8

2019-05-27 Thread Jean-Yves LENHOF

Le 2019-05-27 06:00, Barun kumar a écrit :

Hi Team,

Any idea on ansible rhe 8 support?

Regards,
Barun



Hi,

Is this link helping you ?
https://www.ansible.com/blog/integrating-ansible-and-red-hat-enterprise-linux-8-beta

Regards,

JYL

--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6a0c83d418018b177a53969b89146c35%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] i can't list object

2019-05-02 Thread Jean-Yves LENHOF


Le 02/05/2019 à 08:40, lander7...@gmail.com a écrit :

Hi, i'm use this playbook

---
- hosts: host1
gather_facts: false
connection: local

tasks:
    - name: Gather fact datastore
vmware_datastore_facts:
  hostname: "{{ hostname }}"
  username: "{{ username }}"
  password: "{{ password }}"
  datacenter: Datacenter
  validate_certs: no
delegate_to: localhost
register: datastore_guest

    - debug:
  msg: "{{datastore_guest.datastores}}"
...

and the result is this:

ok: [host1] => {
"msg": [
        {
  "accessible": true,
  "capacity": 492042190848,
  "datastore_cluster": "N/A",
  "freeSpace": 243600982016,
  "maintenanceMode": "normal",
  "multipleHostAccess": false,
  "name": "datastore1",
  "provisioned": 513138893836,
  "type": "VMFS",
  "uncommitted": 264697685004,
  "url": "ds:///vmfs/volumes/5b924bfa-d16b145b-f2fe-dc4a3e868907/"
        }
    ]
}

ok. I want the other result. In only want freeSpace part, but when im 
use datastore_guest.datastores.freeSpace variable the result is:


fatal: [host1]: FAILED! => {"msg": "The task includes an option with 
an undefine                                  d variable. The error 
was: 'list object' has no attribute 'freeSpace'\n\nThe err          or 
appears to have been in '/root/playbook/operations/ListVMvalues.yml': 
line 50          , column 7, but may\nbe elsewhere in the file 
depending on the exact syntax prob  lem.\n\nThe offending line appears 
to be:\n\n\n    - debug:\n      ^ here\n"}


What i do it?



datastore_guest.datastores[0].freeSpace

You should probably works a little to understand what is a list and what 
is a table


Regards,

--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/91176e70-14c1-3d1c-28fa-b7d62d570fcd%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] i can't list hard disk info

2019-05-02 Thread Jean-Yves LENHOF


Le 02/05/2019 à 09:02, lander7...@gmail.com a écrit :

Hi, i use this playbook:

---
- hosts: host1
gather_facts: false
connection: local

tasks:

- name: Gather disk facts from virtual machine using name
  vmware_guest_disk_facts:
    # Unirse a vsphere
    hostname: "{{ hostname }}"
    username: "{{ username }}"
    password: "{{ password }}"
    datacenter: Datacenter
    # Para pasar por el SSH sin autenticar nada
    validate_certs: no
    # Nombre de la maquina
    name: "{{vm}}"
  delegate_to: localhost
  # Lo metemos en una variable
  register: disk_facts

- debug:
    msg: "{{disk_facts.guest_disk_facts}}"
...

and the result is:

ok: [host1] => {
"msg": {
"0": {
    "backing_datastore": "datastore1",
    "backing_disk_mode": "persistent",
    "backing_eagerlyscrub": false,
    "backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos-03.vmdk",

    "backing_thinprovisioned": false,
    "backing_writethrough": false,
    "capacity_in_bytes": 17179869184,
    "capacity_in_kb": 16777216,
    "controller_key": 1000,
    "key": 2000,
    "label": "Hard disk 1",
    "summary": "16,777,216 KB",
    "unit_number": 0
},
"1": {
    "backing_datastore": "datastore1",
    "backing_disk_mode": "persistent",
    "backing_eagerlyscrub": false,
    "backing_filename": "[datastore1] 
ANSIBLE_Centos/ANSIBLE_Centos_3.vmdk",

    "backing_thinprovisioned": false,
    "backing_writethrough": false,
    "capacity_in_bytes": 2147483648,
    "capacity_in_kb": 2097152,
    "controller_key": 1000,
    "key": 2001,
    "label": "Hard disk 2",
    "summary": "2,097,152 KB",
    "unit_number": 1
}
    }
}

Good, i need second ("1") hard disk info, but when im use variable 
disk_facts.guest_disk_facts.1 the result is:


fatal: [host1]: FAILED! => {"msg": "The task includes an option with 
an undefined variable. The error was: dict object has no element 
1\n\nThe error appears to have been in 
'/root/playbook/operations/ListVMvalues.yml': line 50, 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    - debug:\n      
^ here\n"}


What I do?



Hi,

Try with disk_facts.guest_disk_facts[1]instead...

Regards,


JYL



--
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@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56c12ea3-45ea-4382-8bea-b5bd4dd86662%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/67fcf47a-0abd-1d19-02a3-c1d083fd3ea1%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ubuntu 19.04 Support

2019-04-20 Thread Jean-Yves LENHOF



Le 20/04/2019 à 10:48, Abdullah Medhat a écrit :

Hello,

When will the packages for Ubuntu 19.04 be available ?

$ sudo apt update
...
Err:8 http://ppa.launchpad.net/ansible/ansible/ubuntu disco Release
  404  Not Found
...
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ansible/ansible/ubuntu 
disco Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is 
therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user 
configuration details.

...
$

Thanks
AbMedhat



There's one in universe repo

https://packages.ubuntu.com/search?keywords=ansible


Regards,


JYL

--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4b509afa-8532-0f11-3c3f-cefdff5dc326%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Exceptions when trying to use apache2_mod_proxy

2019-03-28 Thread Jean-Yves LENHOF


Le 28/03/2019 à 17:05, Jeff Sondag a écrit :
I'm trying to manage an apache load balancer with apache2_mod_proxy, 
and am getting the following error. If someone could help that would 
be very much appreciated.


I've submitted it as a bug with more information, 
here. https://github.com/ansible/ansible/issues/54259


TASK [apache2_mod_proxy] 

An exception occurred during task execution. To see the full 
traceback, use -vvv. The error was: TypeError: first argument must be 
string or compiled pattern


fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": 
"Traceback (most recent call last):


  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 114, in 

    _ansiballz_main()
  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 106, in _ansiballz_main

    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 49, in invoke_module

    imp.load_module('__main__', mod, module, MOD_DESC)
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 444, in 
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 388, in main
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 271, in get_member_status
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 260, in get_member_attributes

  File \"/usr/lib64/python2.7/re.py\", line 142, in search
    return _compile(pattern, flags).search(string)
  File \"/usr/lib64/python2.7/re.py\", line 238, in _compile
    raise TypeError, \"first argument must be string or compiled pattern\"
TypeError: first argument must be string or compiled pattern
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}

-
My playbook:


- name: test apache load balancer management
  hosts: localhost
  gather_facts: no
  tasks:

  - apache2_mod_proxy:
      balancer_vhost: 10.10.20.30
      tls: yes
      validate_certs: no



Did you enabled balancer-manager as written in documentation ?

https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html

Regards,

--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c0a9ae3b-79c4-f903-f747-06dc1b2b7c13%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Exceptions when trying to use apache2_mod_proxy

2019-03-28 Thread Jean-Yves LENHOF


Le 28/03/2019 à 17:05, Jeff Sondag a écrit :
I'm trying to manage an apache load balancer with apache2_mod_proxy, 
and am getting the following error. If someone could help that would 
be very much appreciated.


I've submitted it as a bug with more information, 
here. https://github.com/ansible/ansible/issues/54259


TASK [apache2_mod_proxy] 

An exception occurred during task execution. To see the full 
traceback, use -vvv. The error was: TypeError: first argument must be 
string or compiled pattern


fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": 
"Traceback (most recent call last):


  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 114, in 

    _ansiballz_main()
  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 106, in _ansiballz_main

    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File 
\"/root/.ansible/tmp/ansible-tmp-1553280134.74-29374324244571/AnsiballZ_apache2_mod_proxy.py\", 
line 49, in invoke_module

    imp.load_module('__main__', mod, module, MOD_DESC)
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 444, in 
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 388, in main
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 271, in get_member_status
  File \"/tmp/ansible_apache2_mod_proxy_payload_6P4Nj2/__main__.py\", 
line 260, in get_member_attributes

  File \"/usr/lib64/python2.7/re.py\", line 142, in search
    return _compile(pattern, flags).search(string)
  File \"/usr/lib64/python2.7/re.py\", line 238, in _compile
    raise TypeError, \"first argument must be string or compiled pattern\"
TypeError: first argument must be string or compiled pattern
", "module_stdout": "", "msg": "MODULE FAILURE
See stdout/stderr for the exact error", "rc": 1}

-
My playbook:


- name: test apache load balancer management
  hosts: localhost
  gather_facts: no
  tasks:

  - apache2_mod_proxy:
      balancer_vhost: 10.10.20.30
      tls: yes
      validate_certs: no


Hi,

First point, did you install "BeautifulSoup python module" as written in 
documentation ?


Seems you can install this module with EPEL repo 
(https://centos.pkgs.org/7/epel-x86_64/python-BeautifulSoup-3.2.1-7.el7.noarch.rpm.html)


Regards,

JYL


--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2830ce38-e684-10cf-a778-30754500baad%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ansible got stuck in remote password query?

2019-03-28 Thread Jean-Yves LENHOF


Le 28 mars 2019 14:01:30 GMT+01:00, Harald Dunkel  a 
écrit :
>You mean, you hardwire "systemd-only" into your playbooks? Or
>do you explicitly list the systemd hosts in your inventory file,
>making sure the general service module isn't used by accident?
>
>Ansible is very new to me, but I had the impression that it is
>supposed to hide these internal details.
>
>
>Regards
>Harri
>
>-- 
>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@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ansible-project/505fc4d4-4e5c-8cb5-16e9-2c77dbf60d18%40aixigo.de.
>For more options, visit https://groups.google.com/d/optout.

You can make some tasks depending on os version. So for example use service 
module with RHEL <= 6 and use systemd module with RHEL >=7

When statement and ansible_os_family or ansible_distribution and 
ansible_distribution_major_version could be interesting fact to use

Regards

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.

-- 
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/DE35C4AA-2C2E-4A73-90B8-8500AE32F6D5%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Nmcli module static routes

2019-03-28 Thread Jean-Yves LENHOF


Le 25/03/2019 à 18:43, anil kumar a écrit :

Hi,

Dont see any documentation regarding adding static routes using nmcli modules. 
Is it feasible to add static routes, if yes please let me know and sample 
example would help.


Hi,

What OS are you using ?

On RedHat/CentOS, why not using templates and fill 
/etc/sysconfig/network-scripts/ with files like |route-/ifname/|


|/
/|

|/Regards,/|

|/JYL
/|

--
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@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/095d59a8-4b14-d3ff-b948-e6a46ab5a3be%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.


  1   2   >