[ansible-project] Could anyone help to fix - file module link in list all module and files modules list?

2018-04-15 Thread Chun-Hung Huang
Hi, I don't know it's right or wrong.

If you check the all modules or Files modules list
And try to find how to use file module ( create file or directory in your 
system )

All modules  
-- http://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html

Files modules
-- http://docs.ansible.com/ansible/latest/modules/list_of_files_modules.html

It will show

file - read file contents
 http://docs.ansible.com/ansible/latest/plugins/lookup/file.html#file

not show

file - file - Sets attributes of files
 http://docs.ansible.com/ansible/devel/modules/file_module.html


Is that correct?
Could anyone help to fix it?




Max

-- 
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/1142d5f4-a350-4ee0-b983-b09d56968316%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] iptables module with port forwarding

2016-07-20 Thread Chun-Hung Huang
Hi ALL

I want to use iptables module to manage port forwarding

>  EXT_IP:EXT_PORT  >   INT_IP:INT:PORT

If user request  EXT_IP with port 8001, it will forward to INT_IP ( 
192.168.100.131 ) and port 22. 

I use iptables module but fail

*#* ansible   -m iptables   -a 'table=nat   chain=PREROUTING   protocol=tcp 
  match=tcp   destination_port=8001   jump=REDIRECT 
to_destination=192.168.100.131   to_ports=22'   gateway   --ask-pass


gateway | FAILED! => {

"changed": false, 

"cmd": "/usr/sbin/iptables -t nat -A PREROUTING -p tcp -m tcp -j 
REDIRECT --to-destination 192.168.100.131 --destination-port 8001 
--to-ports 22", 

"failed": true, 

"msg": "iptables v1.4.21: unknown option \"--to-destination\"\nTry 
`iptables -h' or 'iptables --help' for more information.", 

"rc": 2, 

"stderr": "iptables v1.4.21: unknown option \"--to-destination\"\nTry 
`iptables -h' or 'iptables --help' for more information.\n", 

"stdout": "", 

"stdout_lines": []

}


I already check https://docs.ansible.com/ansible/iptables_module.html


Pleas tell me which option I should use?



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 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/d445d5a8-787c-45b3-b41f-7ab20987c73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-06-21 Thread Chun-Hung Huang
Hi James

Thanks :)
It works now

Very thanks for your help


Max

James Tanner於 2016年6月22日星期三 UTC+8上午3時07分49秒寫道:
>
> Your with_items line is indented too far. It should align with the first 
> letter of the word "name".
>
> On Tuesday, June 21, 2016 at 8:57:47 AM UTC-4, Chun-Hung Huang wrote:
>>
>> Hi Mark Matthews and ALL
>>
>> I meet the same problem with create Create multiple VMware guests with a 
>> Playbook.
>> Could your share / show your playbook with me?
>>
>> Or help me to fix my playbook?
>>
>> My playbook is
>>
>>
>> - name: Testing vsphere_guest module in VMware
>>   hosts: localhost
>>   connection: local
>>   vars_prompt:
>> - name: "vcenter_hostname"
>>   prompt: "Enter vcenter hostname"
>>   private: no
>>   default: "vcsa"
>> - name: "vcenter_user"
>>   prompt: "Enter vCenter username"
>>   private: no
>>   default: root
>> - name: "vcenter_pass"
>>   prompt: "Enter vcenter password"
>>   private: yes
>> - name: "esxi_hostname"
>>   prompt: "Enter esxi hostname"
>>   private: no
>>   tasks:
>> - name: Testing gater facts from vSphere
>>   vsphere_guest:
>> vcenter_hostname: "{{ vcenter_hostname }}"
>> validate_certs: no
>> username: "{{ vcenter_user }}"
>> password: "{{ vcenter_pass }}"
>> guest: "{{ item }}"
>> from_template: yes
>> template_src: openSUSELeap42.1_Template
>> esxi:
>>   datacenter: Lab
>>   hostname: "{{ esxi_hostname }}"
>> with_items:
>>   - server01
>>   - server02
>>
>>
>> Error message is
>>
>> fatal: [localhost]: FAILED! => {"failed": true, "msg": "'item' is 
>> undefined"}
>>
>>
>> item is undefined.
>> But I already have with_items ??
>>
>>
>> Thanks
>>
>>
>> Max
>>
>> Mark Matthews於 2016年4月5日星期二 UTC+8下午11時16分15秒寫道:
>>>
>>> Hi guys
>>>
>>> Just to let you know, I just worked it out.
>>>
>>> I removed the following variable "serverlist: files/hostnames "
>>>
>>> And then changed the with_items to the following:
>>>
>>>   with_items:
>>> - ans_testserver01
>>> - ans_testserver02
>>>
>>> The playbook now creates both VMs (ans_testserver01 and 
>>> ans_testserver02) when it is run.
>>>
>>> I dont know if that is the correct way of doing it, but it seems to be 
>>> working for me.
>>>
>>>
>>>
>>> On Thursday, March 10, 2016 at 5:00:18 PM UTC, Mark Matthews wrote:
>>>>
>>>> Hi
>>>>
>>>> Is it at all possible to create multiple VMware VM's using an Ansible 
>>>> playbook? Giving each VM a unique name (server1, server2, server3, 
>>>> server4)?
>>>>
>>>> I can see anyway of doing this using the following playbooks, as it 
>>>> keeps failing?
>>>>
>>>> ---
>>>>  - hosts: 127.0.0.1
>>>>connection: local
>>>>user: root
>>>>sudo: false
>>>>gather_facts: false
>>>>serial: 1
>>>>vars:
>>>>  vcenter_hostname: UK.server.local
>>>>  esxhost: xxx.xxx.xxx.xxx
>>>>  datastore: UK1
>>>>  network: Web
>>>>  vmcluster: UKCLUSTER
>>>>  guest_name: server1, server2, server3, server4 
>>>>  folder: Utilities
>>>>  notes: Created by Ansible
>>>>
>>>>tasks:
>>>> - name: Create VM from template
>>>>   vsphere_guest:
>>>> vcenter_hostname: "{{ vcenter_hostname }}"
>>>> username: "{{ username }}"
>>>> password: "{{ password }}"
>>>> guest: "{{ guest_name }}"
>>>> vm_extra_config:
>>>>   notes: "{{ notes }}"
>>>>   folder: "{{ folder }}"
>>>> from_template: yes
>>>> template_src: "{{ vmtemplate }}"
>>>> cluster: "{{ vmcluster  }}"
>>>> resource_pool: "/Resources"
>>>> 
>>>> esxi:
>>>>   datacenter: UK
>>>>   hostname: "{{ esxhost }}"
>>>>
>>>> Any ideas or suggestions would be really appreciated.
>>>>
>>>> Cheers
>>>>
>>>>

-- 
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/d891a706-5144-405c-b50f-ee6172c5e772%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Create multiple VMware guests with a Playbook?

2016-06-21 Thread Chun-Hung Huang
Hi Mark Matthews and ALL

I meet the same problem with create Create multiple VMware guests with a 
Playbook.
Could your share / show your playbook with me?

Or help me to fix my playbook?

My playbook is


- name: Testing vsphere_guest module in VMware
  hosts: localhost
  connection: local
  vars_prompt:
- name: "vcenter_hostname"
  prompt: "Enter vcenter hostname"
  private: no
  default: "vcsa"
- name: "vcenter_user"
  prompt: "Enter vCenter username"
  private: no
  default: root
- name: "vcenter_pass"
  prompt: "Enter vcenter password"
  private: yes
- name: "esxi_hostname"
  prompt: "Enter esxi hostname"
  private: no
  tasks:
- name: Testing gater facts from vSphere
  vsphere_guest:
vcenter_hostname: "{{ vcenter_hostname }}"
validate_certs: no
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
guest: "{{ item }}"
from_template: yes
template_src: openSUSELeap42.1_Template
esxi:
  datacenter: Lab
  hostname: "{{ esxi_hostname }}"
with_items:
  - server01
  - server02


Error message is

fatal: [localhost]: FAILED! => {"failed": true, "msg": "'item' is 
undefined"}


item is undefined.
But I already have with_items ??


Thanks


Max

Mark Matthews於 2016年4月5日星期二 UTC+8下午11時16分15秒寫道:
>
> Hi guys
>
> Just to let you know, I just worked it out.
>
> I removed the following variable "serverlist: files/hostnames "
>
> And then changed the with_items to the following:
>
>   with_items:
> - ans_testserver01
> - ans_testserver02
>
> The playbook now creates both VMs (ans_testserver01 and ans_testserver02) 
> when it is run.
>
> I dont know if that is the correct way of doing it, but it seems to be 
> working for me.
>
>
>
> On Thursday, March 10, 2016 at 5:00:18 PM UTC, Mark Matthews wrote:
>>
>> Hi
>>
>> Is it at all possible to create multiple VMware VM's using an Ansible 
>> playbook? Giving each VM a unique name (server1, server2, server3, server4)?
>>
>> I can see anyway of doing this using the following playbooks, as it keeps 
>> failing?
>>
>> ---
>>  - hosts: 127.0.0.1
>>connection: local
>>user: root
>>sudo: false
>>gather_facts: false
>>serial: 1
>>vars:
>>  vcenter_hostname: UK.server.local
>>  esxhost: xxx.xxx.xxx.xxx
>>  datastore: UK1
>>  network: Web
>>  vmcluster: UKCLUSTER
>>  guest_name: server1, server2, server3, server4 
>>  folder: Utilities
>>  notes: Created by Ansible
>>
>>tasks:
>> - name: Create VM from template
>>   vsphere_guest:
>> vcenter_hostname: "{{ vcenter_hostname }}"
>> username: "{{ username }}"
>> password: "{{ password }}"
>> guest: "{{ guest_name }}"
>> vm_extra_config:
>>   notes: "{{ notes }}"
>>   folder: "{{ folder }}"
>> from_template: yes
>> template_src: "{{ vmtemplate }}"
>> cluster: "{{ vmcluster  }}"
>> resource_pool: "/Resources"
>> 
>> esxi:
>>   datacenter: UK
>>   hostname: "{{ esxhost }}"
>>
>> Any ideas or suggestions would be really appreciated.
>>
>> Cheers
>>
>>

-- 
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/611c0fa0-e272-47c2-bcdc-d6bd3cbb86fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: New to ansible, trying to get ping to work but getting Paramiko/SSH errors

2016-01-04 Thread Chun-Hung Huang
Any firewall rule with your local machine?
--- in linux try to check your firewall 
$ sudo iptables -L 

Check /etc/hosts.allow and /etc/hosts.deny

Does port 22 open in your local machine?
$ netstat -tupln 

^^


Ravi B於 2016年1月5日星期二 UTC+8上午12時27分04秒寫道:
>
> Hi everyone,
> I'm new to ansible and trying to get the basing ping working on local 
> host (127.0.0.1 in the $ANSIBLE_HOSTS file) but keep running into 
> problems.I thought the problem was python3 that was installed on the 
> machine, but I uninstalled python3 (deleted the python3 binaries and 
> reinstalled ansible from source). I'm still getting the same error with 
> ansible (see the error below in red).
> The command "ansible all -m ping" is not working.
>
> # python -V
> Python 2.7.11
>
> # pip install --upgrade paramiko
> Requirement already up-to-date: paramiko in 
> /usr/local/lib/python2.7/site-packages/paramiko-1.16.0-py2.7.egg
> Requirement already up-to-date: pycrypto!=2.4,>=2.1 in 
> /usr/local/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-x86_64.egg 
> (from paramiko)
> Requirement already up-to-date: ecdsa>=0.11 in 
> /usr/local/lib/python2.7/site-packages/ecdsa-0.13-py2.7.egg (from paramiko)
>
> # cat $ANSIBLE_HOSTS
> 127.0.0.1
>
> # ansible --version
> ansible 1.9.4
>   configured module search path = None
>
> *# ansible all -m ping*
> *No handlers could be found for logger "paramiko.transport"*
> *127.0.0.1 | FAILED => FAILED: Error reading SSH protocol banner[Errno 
> 104] Connection reset by peer*
>
> *I'm getting the same error with ansible 2 also*
> # ansible --version
> ansible 2.1.0
>   config file =
>   configured module search path = Default w/o overrides
>
> # ansible all -m ping
> No handlers could be found for logger "paramiko.transport"
> 127.0.0.1 | UNREACHABLE! => {
> "changed": false,
> "msg": "ERROR! Error reading SSH protocol banner[Errno 104] Connection 
> reset by peer",
> "unreachable": true
> }
>
>

-- 
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/3801abba-bfe5-4fd3-8d76-a454c59ee458%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible create an IAM user with a group and with administrator privilege

2015-11-29 Thread Chun-Hung Huang
Sorry for misunderstand :-)
<(_ _)>

I don't use AWS, I think other one could help you


Adithya Khamithkar於 2015年11月29日星期日 UTC-6下午3時40分50秒寫道:
>
> Thia is for adding a user on linux. I want to add an IAM user on AWS. :) 
>
> On Mon Nov 30 03:06:36 2015 GMT+0530, Chun-Hung Huang wrote: 
> > Hi, Is something like this 
> > 
> > > cat test_group_user.yml 
> > 
> > 
> > - name: Test group and user module 
> > 
> >   hosts: testserver 
> > 
> >   vars: 
> > 
> > username: sakanamax 
> > 
> >   tasks: 
> > 
> > - name: Add administrator group 
> > 
> >   sudo: True 
> > 
> >   group: name=administrator state=present 
> > 
> > - name: Add user sakana and add to administrator group 
> > 
> >   sudo: True 
> > 
> >   user: name={{ username }} group=administrator 
> > 
> > 
> > 
> > 
> > 
> > Adithya Khamithkar於 2015年11月28日星期六 UTC-6下午10時53分11秒寫道: 
> > > 
> > > Yes I want to add a user in IAM the user name will be a variable that 
> I'll 
> > > pass from my vars file. And I want that user to be added in that group 
> > > called administrator. 
> > > 
> > > ~Adithya Khamithkar 
> > > 
> > > On Sun, Nov 29, 2015 at 12:07 AM, Chun-Hung Huang  > > > wrote: 
> > > 
> > >> Hi 
> > >> 
> > >> Do you mean 
> > >> - you want to add a user which name is IAM ? 
> > >> - the user belong to a group ? ( which name is group name ) 
> > >> - with adminisrator privilege, sudo users? 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> Adithya Khamithkar於 2015年11月28日星期六 UTC-6上午7時23分12秒寫道: 
> > >>> 
> > >>> Hi, 
> > >>> 
> > >>> Can someone please help me in creating an IAM user with a group and 
> with 
> > >>> administrator privilege 
> > >>> 
> > >>> Thanks, 
> > >>> 
> > >> -- 
> > >> You received this message because you are subscribed to a topic in 
> the 
> > >> Google Groups "Ansible Project" group. 
> > >> To unsubscribe from this topic, visit 
> > >> 
> https://groups.google.com/d/topic/ansible-project/JLmcELQtD8M/unsubscribe 
> > >> . 
> > >> To unsubscribe from this group and all its topics, send an email to 
> > >> ansible-proje...@googlegroups.com . 
> > >> To post to this group, send email to ansible...@googlegroups.com 
> > >> . 
> > >> To view this discussion on the web visit 
> > >> 
> https://groups.google.com/d/msgid/ansible-project/b905ccd6-c46a-4bfd-a1eb-6b7ba8ea4975%40googlegroups.com
>  
> > >> <
> https://groups.google.com/d/msgid/ansible-project/b905ccd6-c46a-4bfd-a1eb-6b7ba8ea4975%40googlegroups.com?utm_medium=email&utm_source=footer>
>  
>
> > >> . 
> > >> For more options, visit https://groups.google.com/d/optout. 
> > >> 
> > > 
> > > 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> Google Groups "Ansible Project" group. 
> > To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/ansible-project/JLmcELQtD8M/unsubscribe. 
>
> > To unsubscribe from this group and all its topics, send an email to 
> ansible-proje...@googlegroups.com . 
> > To post to this group, send email to ansible...@googlegroups.com 
> . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/6222cdc0-6f5c-4c2c-b4c9-b229b199abd1%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
> > 
>
> -- 
> Sent from my Jolla

-- 
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/47d8d27d-d962-48af-87e0-7bb0462113b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Ansible create an IAM user with a group and with administrator privilege

2015-11-29 Thread Chun-Hung Huang
Hi, Is something like this

> cat test_group_user.yml 


- name: Test group and user module

  hosts: testserver

  vars:

username: sakanamax

  tasks:

- name: Add administrator group

  sudo: True

  group: name=administrator state=present

- name: Add user sakana and add to administrator group

  sudo: True

  user: name={{ username }} group=administrator





Adithya Khamithkar於 2015年11月28日星期六 UTC-6下午10時53分11秒寫道:
>
> Yes I want to add a user in IAM the user name will be a variable that I'll 
> pass from my vars file. And I want that user to be added in that group 
> called administrator.
>
> ~Adithya Khamithkar
>
> On Sun, Nov 29, 2015 at 12:07 AM, Chun-Hung Huang  > wrote:
>
>> Hi
>>
>> Do you mean 
>> - you want to add a user which name is IAM ?
>> - the user belong to a group ? ( which name is group name )
>> - with adminisrator privilege, sudo users?
>>
>>
>>
>>
>>
>> Adithya Khamithkar於 2015年11月28日星期六 UTC-6上午7時23分12秒寫道:
>>>
>>> Hi,
>>>
>>> Can someone please help me in creating an IAM user with a group and with 
>>> administrator privilege 
>>>
>>> Thanks,
>>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/ansible-project/JLmcELQtD8M/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to 
>> ansible-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/b905ccd6-c46a-4bfd-a1eb-6b7ba8ea4975%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/b905ccd6-c46a-4bfd-a1eb-6b7ba8ea4975%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/6222cdc0-6f5c-4c2c-b4c9-b229b199abd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible create an IAM user with a group and with administrator privilege

2015-11-28 Thread Chun-Hung Huang
Hi

Do you mean 
- you want to add a user which name is IAM ?
- the user belong to a group ? ( which name is group name )
- with adminisrator privilege, sudo users?





Adithya Khamithkar於 2015年11月28日星期六 UTC-6上午7時23分12秒寫道:
>
> Hi,
>
> Can someone please help me in creating an IAM user with a group and with 
> administrator privilege 
>
> 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 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/b905ccd6-c46a-4bfd-a1eb-6b7ba8ea4975%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.