[ansible-project] Install&Configure raid1 and bios on a HP ilo server

2020-08-28 Thread devo...@gmail.com
Hi,

Need to install and configure raid1 and bios on a HP ilo server (before OS 
installation) by ansible playbook. Can we install raid1 and bios by CLI on 
a HP ILO (has to done by ansible playbook), if yes can you please give me a 
reference.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/77ab9b14-994e-4750-a9d5-68e27a6dc714n%40googlegroups.com.


Re: [ansible-project] Generate HTML Table from Ansible Inventory File

2020-08-28 Thread Vladimir Botka
On Fri, 28 Aug 2020 11:56:09 -0700 (PDT)
Xinhuan Zheng  wrote:

> [group1]
> server1.example.com
> server2.example.com
> 
> [group2]
> server3.example.com
> server4.example.com
> 
> [group1:vars]
> field1=a1
> field2=a2
> 
> [group2:vars]
> field1=a3
> field2=a4
>   
> server1.example.coma1a2
> server2.example.coma1a2
> server3.example.coma3a4
> server4.example.coma4a4

The playbook

  - hosts: all
tasks:
  - template:
  src: table.html.j2
  dest: table.html
delegate_to: localhost
run_once: true

and the template 
https://gist.github.com/vbotka/a43e33f2a2951ef434f72ebd98a9eb3e

  shell> cat table.html.j2
  {% for host in ansible_play_hosts %}
  {{ host }} {{ hostvars[host]['field1'] }} {{
hostvars[host]['field2'] }}
  {% endfor %}

give

  shell> cat table.html
  server1.example.com a1 a2
  server2.example.com a1 a2
  server3.example.com a3 a4
  server4.example.com a3 a4

Add the html code to the template. See "Jinja"
https://jinja.palletsprojects.com/en/2.11.x/en/

-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200828220637.513bd1a2%40gmail.com.


pgp7zer48piD1.pgp
Description: OpenPGP digital signature


[ansible-project] Generate HTML Table from Ansible Inventory File

2020-08-28 Thread Xinhuan Zheng
Hello,

I have an inventory file like below:

[group1]
server1.example.com
server2.example.com

[group2]
server3.example.com
server4.example.com

[group1:vars]
field1=a1
field2=a2

[group2:vars]
field1=a3
field2=a4

I need to generate an HTML file like below:


  Inventory
  
  
 
  HostField1Field2
 
 
  
server1.example.coma1a2
  
server2.example.coma1a2
  
server3.example.coma3a4
  
server4.example.coma4a4
 
  
  


Basically all the hosts and their values becomes HTML Table. How do I use 
Ansible playbook to accomplish it?

Thank you,

Xinhuan Zheng

-- 
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/9d14c705-e0e0-40fa-81dd-3150d376558fo%40googlegroups.com.


[ansible-project] unzip to unarchive

2020-08-28 Thread 'lpesc...@google.com' via Ansible Project
Hi all, 
I want to change this to unarchive:

- name: unpack-protos-bin
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local 
bin/protoc
  args:
executable: /bin/bash
  notify:
- unpack-proto-includes

- name: unpack-proto-includes
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local include/*
  args:
executable: /bin/bash


This is what I have surmounted, but not sure if it's correct:

- name: unpack-protos-bin
  unarchive:
src: file.zip
dest: /usr/local/bin/protoc
  notify:
- unpack-proto-includes

- name: unpack-proto-includes
  unarchive:
src: 
https://github.com/google/protobuf/releases/download/v3.4.0/file.zip
dest: /usr/local/include/*

Can anyone tell me if I am correct, and if not, how to resolve?


-- 
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/1bdedc60-61a6-4e8e-82be-4cb9a28543b7n%40googlegroups.com.


[ansible-project] Re: unzip to unarchive

2020-08-28 Thread 'lpesc...@google.com' via Ansible Project
I'm also curious about how the -o and -d switches in the original playbook 
relate to the new.

On Friday, August 28, 2020 at 9:41:24 AM UTC-7 lpesc...@google.com wrote:

> Hi all, 
> I want to change this to unarchive:
>
> - name: unpack-protos-bin
>   shell: unzip -o /root/.ansible-management/file.zip -d /usr/local 
> bin/protoc
>   args:
> executable: /bin/bash
>   notify:
> - unpack-proto-includes
>
> - name: unpack-proto-includes
>   shell: unzip -o /root/.ansible-management/file.zip -d /usr/local 
> include/*
>   args:
> executable: /bin/bash
>
>
> This is what I have surmounted, but not sure if it's correct:
>
> - name: unpack-protos-bin
>   unarchive:
> src: file.zip
> dest: /usr/local/bin/protoc
>   notify:
> - unpack-proto-includes
>
> - name: unpack-proto-includes
>   unarchive:
> src: 
> https://github.com/google/protobuf/releases/download/v3.4.0/file.zip
> dest: /usr/local/include/*
>
> Can anyone tell me if I am correct, and if not, how to resolve?
>
>
>

-- 
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/8f5adca6-ecaf-4b49-82cf-029a8066edcbn%40googlegroups.com.


[ansible-project] swapping unzip to unarchive

2020-08-28 Thread 'lpesc...@google.com' via Ansible Project
Hi all, 
I want to change this to unarchive:

- name: unpack-protos-bin
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local 
bin/protoc
  args:
executable: /bin/bash
  notify:
- unpack-proto-includes

- name: unpack-proto-includes
  shell: unzip -o /root/.ansible-management/file.zip -d /usr/local include/*
  args:
executable: /bin/bash


This is what I have surmounted, but not sure if it's correct:

- name: unpack-protos-bin
  unarchive:
src: file.zip
dest: /usr/local/bin/protoc
  notify:
- unpack-proto-includes

- name: unpack-proto-includes
  unarchive:
src: 
https://github.com/google/protobuf/releases/download/v3.4.0/file.zip
dest: /usr/local/include/*

Can anyone tell me if I am correct, and if not, how to resolve?

-- 
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/ba04e762-037e-4b0f-aa22-a7c2a47d1dfdn%40googlegroups.com.


Re: [ansible-project] Trying to use pexpect ansible module to run interactive script

2020-08-28 Thread Sebastian Collins
Legend! I never would have figured this out, so thanking you kindly.

I have hit one error after this:  : 

"argument responses is of type  and we were unable to convert 
to dict" 

for which I have managed to nearly resolve it having found a solution to 
which you again had provided to someone else:  : 
https://groups.google.com/g/ansible-project/c/dDKvb1m5yM8

I now have the ansible task formed liked this:

- name: Setup postcodesiodb
  expect:
echo: yes
chdir: "/apps/was/postcodes.io"
command: npm run setup
timeout: "10"
responses: 
'Postgresql Superuser \(for database creation\) \[default: 
postgres\]': 'postgres'
'New Database Username \(for readonly access\) \[default: 
postcodesio\]': 'postcodesio'
'Password for new user \[default: secret\]': 'secret'
'Postgresql Host \[default: localhost\]': 'localhost'
'Database Name \[default: postcodesiodb\]': 'postcodesiodb'
'Postgresql Port \[default: 5432\]': 5432
  tags:
- setup
- install
- test   

 The task is no longer producing that error and I can see the values being 
populated with the exception the the final Port value which still does not 
look to be parsing "5432" correctly. I have tried removing the single 
quotes around it, to make it clear it is an integer as opposed to a string 
but that has made no difference. I also can't see any discrepancies with 
the escape characters used for regex  compared to the previous responses 
which are now working. Any ideas what I need to do to close this off?

FAILED! => {"changed": true, "cmd": "npm run setup",
...
Apply read-only privileges for the new user to the new database", "", 
"Postgresql Superuser (for database creation) [default: 
postgres]:postgres", "New Database Username (for readonly access) [default: 
postcodesio]:postcodesio", "Password for new user [default: 
secret]:secret", "Postgresql Host [default: localhost]:localhost", 
"Database Name [default: postcodesiodb]:postcodesiodb", "Postgresql Port: 
[default: 5432]:"]}


On Thursday, August 27, 2020 at 2:41:41 PM UTC+1 Matt Martz wrote:

> There are a few problems with your task.
>
> 1. `Question` as used in the example, is supposed to represent the prompt 
> or string to match. So you need to remove that.
> 2. The "questions", prompts, or matches are regex, so you have to escape 
> characters that have special meaning in regex
>
> responses:
> 'Postgresql Superuser \(for database creation\) \[default: 
> postgres\]': 'postgres'
> 'New Database Username \(for readonly access\) \[default: 
> postcodesio\]': 'postcodesio'
> 'Password for new user \[default: secret\]': 'secret'
> 'Postgresql Host \[default: localhost\]': 'localhost'
> 'Database Name \[default: postcodesiodb\]': 'postcodesiodb'
> 'Postgresql Port \[default: 5432\]': '5432'
> On Thu, Aug 27, 2020 at 6:22 AM Sebastian Collins  
> wrote:
>
>> Hi,
>>
>> I have composed this ansible task using the pexpect module to run a 
>> setup.sh script with npm run
>>
>> - name: Setup postcodesiodb
>>   expect:
>> echo: yes
>> chdir: "/apps/was/postcodes.io"
>> command: npm run setup
>> timeout: "10"
>> responses:
>>   Question: 
>>
>> - 'Postgresql Superuser (for database creation) [default: 
>> postgres]': 'postgres'
>>
>> - 'New Database Username (for readonly access) [default: 
>> postcodesio]': 'postcodesio'
>> - 'Password for new user [default: secret]': 'secret'
>> - 'Postgresql Host [default: localhost]': 'localhost'
>> - 'Database Name [default: postcodesiodb]': 'postcodesiodb'
>> - 'Postgresql Port [default: 5432]': '5432'
>>   tags:
>> - setup
>> - install
>> - test   
>>
>>
>>
>> Below is the only error logging I have but it's failed at the first input 
>> I am attempting to populate here the postgres Super user. Any ideas how I 
>> need to pass in these answers and or variables if I don't want to hard 
>> code? Currently it just looks like it is picking up  "] characters.
>>  
>> Fatal: [hostname]: FAILED! => {"changed": true, "cmd": "npm run setup", 
>> "delta": "0:02:00.145566", "end": "2020-08-25 21:33:22.107526", "msg": 
>> "command exceeded timeout", "rc": null, "start": "2020-08-25 
>> 21:31:21.961960",
>> ...
>>  "Postgresql Superuser (for database creation) [default: postgres]:"]}
>>
>> The wording / syntax of the questions when the script is called is 
>> exactly like this:
>> Postgresql Superuser (for database creation) [default: postgres]:
>>
>>
>> I have tried various combinations to frame my inputs e.g. 
>>
>> Question: 
>> - 'Postgresql Superuser (for database creation) [default: 
>> postgres]': 
>> [postgres]
>>
>> or 
>>
>> - 'Postgresql Superuser (for database creation) [default: postgre