Re: [ansible-project] Key Update depending on the OS version

2022-07-11 Thread Prady A
Thank you for all your help always .. I found the solution for the above

   {% if ansible_distribution_major_version == "8"}
   {{  RHEL8_KEY }}
   {% if ansible_distribution_major_version == "7"}
   {{  RHEL7_KEY }}
   {% if ansible_distribution == "Amazon" }
   {{  AMZN_KEY }}
   {% endif %}

On Tue, Jul 12, 2022 at 1:12 PM Prady A  wrote:

> Hello Folk,
>
> Need one help in updating the key to sshd_config file depending on the OS
> version.
>
> I ve folder structure like below
>  - roles
> - sshd
>  - tasks
> main.yml
>  - vars
> main.yml
>  - template
> main.yml
>
> I want to update */template/main.yml* like
>
>{% if ansible_distribution_major_version == "8"}
>Insert   RHEL8 KEY  etc/ssh/sshd_config
>{% if ansible_distribution_major_version == "7"}
>Inset  RHEL7 KEY to etc/ssh/sshd_config
>{% if ansible_distribution == "Amazon" }
>   Inset  Amazon KEY to etc/ssh/sshd_config
>{% endif %}
>
> my *tasks/main.yml *
>
> - name : Update the key in sshd_config
>  template:
>  src: template/sshd.conf.j2
>  dest: /etc/ssh/sshd_config
>
> Can I write KEY in Vars/main.yml and update the /etc/ssh/sshd_config file.
> The above is my approach till now but please somebody help me how can I
> update the sshd_config file with the key.
>
> Like in */vars/main.yml*
>
>  RHEL8_KEY = xyz
>  RHEL7_KEY = abc
>  RHEL6_KEY = mno
>  AMAZON_KEY = amazon
>
> 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEuB3AoYxMXLFRdVAxg4-tOG-%2B4UN%2B6fjOtiD6CFdeKXcu%2B0bg%40mail.gmail.com.


[ansible-project] Key Update depending on the OS version

2022-07-11 Thread Prady A
Hello Folk,

Need one help in updating the key to sshd_config file depending on the OS
version.

I ve folder structure like below
 - roles
- sshd
 - tasks
main.yml
 - vars
main.yml
 - template
main.yml

I want to update */template/main.yml* like

   {% if ansible_distribution_major_version == "8"}
   Insert   RHEL8 KEY  etc/ssh/sshd_config
   {% if ansible_distribution_major_version == "7"}
   Inset  RHEL7 KEY to etc/ssh/sshd_config
   {% if ansible_distribution == "Amazon" }
  Inset  Amazon KEY to etc/ssh/sshd_config
   {% endif %}

my *tasks/main.yml *

- name : Update the key in sshd_config
 template:
 src: template/sshd.conf.j2
 dest: /etc/ssh/sshd_config

Can I write KEY in Vars/main.yml and update the /etc/ssh/sshd_config file.
The above is my approach till now but please somebody help me how can I
update the sshd_config file with the key.

Like in */vars/main.yml*

 RHEL8_KEY = xyz
 RHEL7_KEY = abc
 RHEL6_KEY = mno
 AMAZON_KEY = amazon

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


Re: [ansible-project] Need when condition / solution if possible for running task on a specific host

2022-07-11 Thread Dick Visser
Suppose your playbook does what you (think) you want. Then what do you
intend to do with this output?
What if some apps are running on hosts they're not intended to run on? Do
you take some corrective measures? Or reinstall the host?
And why is it possible at all that apps appear on random inventory hosts?

Rather than using ansible as a glorified shell wrapper to report proces
status, I would use it to set up the infra so that only the right apps run
on the right hosts.


On Tue, 12 Jul 2022 at 00:16, Mohtashim S  wrote:

> I have 3 applications hosted on three separate hosts and mentioned in the
> hosts file like below:
>
> cat my.hosts
>
> [app1_webapp]
> host3.mybank.com
>
> [app2_webapp]
> host5.mybank.com
>
> [app3_webapp]
> host8.mybank.com
> My requirement is to run two types of raw module commands.
>
> The first raw task which should run on all three hosts for all three
> applications i.e uptime
>
> The second raw task is ps command that should run only on the respective
> host i.e ps -ef | grep app1 should only run on host3.mybank.com
>
> Below is how I call my main.yml
>
> ansible-playbook -i my.hosts main.yml -e appname=app1,app2,app3
>
> cat main.yml
>
> - hosts: "{{ product(appname.split(',')) |
> product(['webapp'])|map('flatten')|map('join', '_') }}"
>
>   user: user1
>   gather_facts: no
>
>   tasks:
>
>- name: Check Running Process
>  raw: "ps -ef | grep {{ item }}"
>  register: psout
>  with_items: "{{ appname.split(',') }}"
>
>- name: DUMP Running Process
>  debug:
>msg: "{{ psout.stdout }}"
>
> The above raw fails as it tried ps for each app on each hosts which is
> what I wish to skip (correct).
>
> How do I put a when condition so that the ps command for the respective
> app should run on the respective host only and not on all three hosts?
>
> Summary: my problem is regarding standard practice in infrastructure
> management. Each app runs on its own host as specified in the my.hosts
> file. I wish to find if the app process ps -ef | grep  is running
> on its own host(desired) and not on all inventory-hosts
>
> --
> 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/ef324a05-5da8-41e2-b214-611dfdc9afcbn%40googlegroups.com
> 
> .
>
-- 
Sent from Gmail Mobile

-- 
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/CAF8BbLZ4%2BhU-%3DyktRAXrnkjk0Zw5Qy0G3sU8gBdWioFA5bKMxg%40mail.gmail.com.


[ansible-project] Need when condition / solution if possible for running task on a specific host

2022-07-11 Thread Mohtashim S
I have 3 applications hosted on three separate hosts and mentioned in the 
hosts file like below:

cat my.hosts

[app1_webapp]
host3.mybank.com

[app2_webapp]
host5.mybank.com

[app3_webapp]
host8.mybank.com
My requirement is to run two types of raw module commands.

The first raw task which should run on all three hosts for all three 
applications i.e uptime

The second raw task is ps command that should run only on the respective 
host i.e ps -ef | grep app1 should only run on host3.mybank.com

Below is how I call my main.yml

ansible-playbook -i my.hosts main.yml -e appname=app1,app2,app3

cat main.yml

- hosts: "{{ product(appname.split(',')) | 
product(['webapp'])|map('flatten')|map('join', '_') }}"

  user: user1
  gather_facts: no

  tasks:

   - name: Check Running Process
 raw: "ps -ef | grep {{ item }}"
 register: psout
 with_items: "{{ appname.split(',') }}"

   - name: DUMP Running Process
 debug: 
   msg: "{{ psout.stdout }}"

The above raw fails as it tried ps for each app on each hosts which is what 
I wish to skip (correct).

How do I put a when condition so that the ps command for the respective app 
should run on the respective host only and not on all three hosts?

Summary: my problem is regarding standard practice in infrastructure 
management. Each app runs on its own host as specified in the my.hosts 
file. I wish to find if the app process ps -ef | grep  is running 
on its own host(desired) and not on all inventory-hosts

-- 
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/ef324a05-5da8-41e2-b214-611dfdc9afcbn%40googlegroups.com.


[ansible-project] Re: ANSIBLE_JINJA2_NATIVE not working in user module for expires key

2022-07-11 Thread senorsmile
It looks like I had a typo as everything is now working.  

On Monday, July 11, 2022 at 12:07:34 PM UTC-7 senorsmile wrote:

>
>
> I'm trying to pass a generic date to the expires key in the user module 
> and convert it inline so that our inventory doesn't have to include this 
> same jinja over and over: 
>
>
> ```
> users:
>   name: asmith
>   comment: Adam Smith
>   key_exclusive: true
>   key: |
> abcdefghijklmnopqrstuvwxyz
>
> create_users:
>   - >
> {{ users['asmith']  | combine(
>   {'expires':("2022-07-12 00:00:00" | to_datetime).strftime("%s")
>   ,'state':'present'
>   })
> }}
> ```
>
> My try thus far is
>
> ```yaml
> - name: Create/Remove users
>   user:
> name: "{{ item.name }}"
> update_password: "{{ item.update_password | default('always') }}"
> password: "{{ item.password | default(omit) }}"
> state:"{{ item.state| default('present') }}"
> remove:   "{{ item.remove   | default('no') }}"
> shell:"{{ item.shell| default('/bin/bash') }}"
> comment:  "{{ item.comment  | default(omit) }}"
> # account expires on whole day only
> expires:  "{% if 'expires' in item %}{{ ((item.expires + ' 00:00:00') 
> | to_datetime).strftime('%s') | int }}{% else %}-1{% endif %}"
> group:"{{ item.name }}"
> groups:   "{{ item.groups | default(omit) }}"
> append:   "{{ item.append   | default('no') }}" # "no" =  always 
> remove from unspecified groups
>   loop: "{{ create_users }}"
>   loop_control:
> label: "{{ item.name }}"
>   when:
> - create_users is defined
> ```
>
> I call ansible-playbook with env var ANSIBLE_JINJA2_NATIVE=True.
>
> However, I get the error: 
> ```
> failed: [node1] (item=asmith) => changed=false 
>   ansible_loop_var: item
>   item:
> comment: Adam Smith
> groups:
> - admin
> key: |-
>   abcdefghijklmnopqrstuvwxyz
> name: asmith
>   msg: 'argument expires is of type  and we were unable to 
> convert to float:  cannot be converted to a float'
> ```
>
>
>

-- 
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/2f7af27f-ddd7-4b96-b574-76d084f158ccn%40googlegroups.com.


Re: [ansible-project] docker_container - container stops without completing the commands

2022-07-11 Thread 'Felix Fontein' via Ansible Project
Hi,

I assume that running "dnf install -y make gcc openssl-devel
libxml2-devel lz4-devel libzstd-devel bzip2-devel" is done after ~90
seconds.

You are asking for that command to be run in a container, once that
command finishes, the container exists. That's how Docker works, and it
would behave exactly the same as the module if you start a detached
container from the Docker CLI.

If you want the container to keep existing, you need to use a command
that does not exit.

Basically what you ask the module to do is equivalent to running

  docker run --detach --interactive --tty --workdir /build \
 -v /data/build/:/build --name pgBackRestBuilder \
 docker.io/rockylinux:8 dnf install -y make gcc openssl-devel \
 libxml2-devel lz4-devel libzstd-devel bzip2-devel

on the command line.

Cheers,
Felix



> I want to create a docker container on a remote host and then, in a
> second step build a binary for pgBackRest inside that container. It
> fails with the task to create the container, install some packages
> for the build and then remain to run. 
> - name: creating a build-container
> docker_container:name: pgBackRestBuilder
> image: docker.io/rockylinux:8
> volumes:
> - /data/build/:/build
> state: started
> restart: true
> detach: true
> tty: true
> interactive: true
> working_dir: /build
> command: dnf install -y make gcc openssl-devel libxml2-devel
> lz4-devel libzstd-devel bzip2-devel become: true
>  
>  
> What happens is that the container is being spun up, running for
> about 90 seconds and then shutting down without (as far as I can
> tell) having installed i.e. make. I was thinking the detach, tty &
> interactive options should have made the container to last. any hint,
> what I am doing wrong 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/20220711213539.4db75a93%40rovaniemi.


[ansible-project] ANSIBLE_JINJA2_NATIVE not working in user module for expires key

2022-07-11 Thread senorsmile


I'm trying to pass a generic date to the expires key in the user module and 
convert it inline so that our inventory doesn't have to include this same 
jinja over and over: 


```
users:
  name: asmith
  comment: Adam Smith
  key_exclusive: true
  key: |
abcdefghijklmnopqrstuvwxyz

create_users:
  - >
{{ users['asmith']  | combine(
  {'expires':("2022-07-12 00:00:00" | to_datetime).strftime("%s")
  ,'state':'present'
  })
}}
```

My try thus far is

```yaml
- name: Create/Remove users
  user:
name: "{{ item.name }}"
update_password: "{{ item.update_password | default('always') }}"
password: "{{ item.password | default(omit) }}"
state:"{{ item.state| default('present') }}"
remove:   "{{ item.remove   | default('no') }}"
shell:"{{ item.shell| default('/bin/bash') }}"
comment:  "{{ item.comment  | default(omit) }}"
# account expires on whole day only
expires:  "{% if 'expires' in item %}{{ ((item.expires + ' 00:00:00') | 
to_datetime).strftime('%s') | int }}{% else %}-1{% endif %}"
group:"{{ item.name }}"
groups:   "{{ item.groups | default(omit) }}"
append:   "{{ item.append   | default('no') }}" # "no" =  always remove 
from unspecified groups
  loop: "{{ create_users }}"
  loop_control:
label: "{{ item.name }}"
  when:
- create_users is defined
```

I call ansible-playbook with env var ANSIBLE_JINJA2_NATIVE=True.

However, I get the error: 
```
failed: [node1] (item=asmith) => changed=false 
  ansible_loop_var: item
  item:
comment: Adam Smith
groups:
- admin
key: |-
  abcdefghijklmnopqrstuvwxyz
name: asmith
  msg: 'argument expires is of type  and we were unable to 
convert to float:  cannot be converted to a float'
```


-- 
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/b5d12bc3-e8bb-417a-949f-bcad5e718773n%40googlegroups.com.


Re: [Ext] [ansible-project] RHCE exam question

2022-07-11 Thread Mahdi Idriss
Thank you Rilindo Foster, I had no idea about this regulation, I will
delete the post.



On Mon, Jul 11, 2022 at 6:47 PM Rilindo Foster 
wrote:

> Hi Mahdi!
>
> Red Hat NDA actually prohibits you from discussing specific exam questions
> and can result in you and other people being banned from future exams as
> well as revocation of any Red Hat you may have already obtained.
>
> I would recommend not bringing up exam specific questions in the future.
>
> —
> Rilindo Foster - Cloud Reliability Architect
> fost...@nextcapital.com
> NextCapital Group, Inc.
> 104 S. Michigan Avenue, Suite 1400
> Chicago, IL  60603-5958
>
> On Jul 11, 2022, at 3:59 AM, Mahdi Idriss 
> wrote:
>
> Hi guys,
>
> I had this question on my last ex294 ansible exame, so I was not able to
> solve it, anyone have the right playbook or can create one?
>
> Create a playbook called roles. yml with requirements:
> · The playbook contains a play that runs on hosts in the
> balancers host group and uses the *balancer role*:
> 1.   This role configures a service to load balance web server
> requests between hosts in the webservers host group
> 2.   Browsing to hosts in the balancers host group (example:
> http://node5...com) produces the output: *Welcome message on
> 192.168.1.10*
> 3.   Reloading the browser produces output from the alternate web
> server: *Welcome message on 192.168.1.11*
> ·
> · The playbook contains a play that runs on hosts in the
> webservers host group and uses the *phpinfo role*:
> 1.   Browsing to hosts in the webservers host group with the URL
>  /hello .php produces the following output: *Hello  PHP World  from
> {{ansible_fqdn}}*
>
>
> 2.For ex:  browsing to http://*node3*com/hello.php, produces
> the following output: Hello PHP World from *node3*…...com (Note: along
> with various details of the PHP configuration including the version of PHP
> that is installed)
>
>
>
>
>
> 3.   Similarly browsing to http://*node4*com/hello.php. produces
> the following output: Hello PHP World from *node4*…...com (Note: along
> with various details of the PHP configuration including the version of PHP
> that is installed.)
>
> --
> 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/CADHi4Y8%3DP7BuZLLStqELaac3jn7_Jh%2BZYT68xFEmmjTcwFvZJA%40mail.gmail.com
> 
> .
>
>
>
> This email and its attachments are confidential and may be privileged.
> Any unauthorized use or disclosure is prohibited.  If you receive this
> email in error, please notify the sender and permanently delete the
> original without forwarding, making any copies or disclosing its contents.
> NextCapital is a brand name representing NextCapital Group, Inc. and its
> subsidiaries, NextCapital Software, Inc. and NextCapital Advisers, Inc.
>
> --
> 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/F5B75710-B69F-4F17-B598-53D6D2A8DF5C%40nextcapital.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/CADHi4Y-fDXxXOMsbRZctJ-saeu3Qi5Vo4k7M8dcMcsETsAmaNg%40mail.gmail.com.


Re: [Ext] [ansible-project] RHCE exam question

2022-07-11 Thread Rilindo Foster
Hi Mahdi!

Red Hat NDA actually prohibits you from discussing specific exam questions and 
can result in you and other people being banned from future exams as well as 
revocation of any Red Hat you may have already obtained. 

I would recommend not bringing up exam specific questions in the future.

—
Rilindo Foster - Cloud Reliability Architect
fost...@nextcapital.com
NextCapital Group, Inc.
104 S. Michigan Avenue, Suite 1400
Chicago, IL  60603-5958

> On Jul 11, 2022, at 3:59 AM, Mahdi Idriss  wrote:
> 
> Hi guys,
> 
> I had this question on my last ex294 ansible exame, so I was not able to 
> solve it, anyone have the right playbook or can create one?
> 
> Create a playbook called roles. yml with requirements:
> · The playbook contains a play that runs on hosts in the balancers 
> host group and uses the balancer role:
> 1.   This role configures a service to load balance web server requests 
> between hosts in the webservers host group
> 2.   Browsing to hosts in the balancers host group (example: 
> http://node5. ..com) produces the output: Welcome message 
> on 192.168.1.10
> 3.   Reloading the browser produces output from the alternate web server: 
> Welcome message on 192.168.1.11
> ·  
> · The playbook contains a play that runs on hosts in the webservers 
> host group and uses the phpinfo role:
> 1.   Browsing to hosts in the webservers host group with the URL  /hello 
> .php produces the following output: Hello  PHP World  from {{ansible_fqdn}}
>  
> 2.For ex:  browsing to http://node3com/hello.php, produces the 
> following output: Hello PHP World from node3…...com (Note: along with various 
> details of the PHP configuration including the version of PHP that is 
> installed)
>  
>  
> 3.   Similarly browsing to http://node4com/hello.php. produces the 
> following output: Hello PHP World from node4…...com (Note: along with various 
> details of the PHP configuration including the version of PHP that is 
> installed.)
> 
> 
> -- 
> 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/CADHi4Y8%3DP7BuZLLStqELaac3jn7_Jh%2BZYT68xFEmmjTcwFvZJA%40mail.gmail.com
>  
> .


-- 
This email and its attachments are confidential and may be privileged.  Any 
unauthorized use or disclosure is prohibited.  If you receive this email in 
error, please notify the sender and permanently delete the original without 
forwarding, making any copies or disclosing its contents. NextCapital is a 
brand name representing NextCapital Group, Inc. and its subsidiaries, 
NextCapital Software, Inc. and NextCapital Advisers, Inc. 

-- 
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/F5B75710-B69F-4F17-B598-53D6D2A8DF5C%40nextcapital.com.


[ansible-project] docker_container - container stops without completing the commands

2022-07-11 Thread dulhaver via Ansible Project
 
I want to create a docker container on a remote host and then, in a second step 
build a binary for pgBackRest inside that container.
It fails with the task to create the container, install some packages for the 
build and then remain to run.
 
 
- name: creating a build-container
docker_container:name: pgBackRestBuilder
image: docker.io/rockylinux:8
volumes:
- /data/build/:/build
state: started
restart: true
detach: true
tty: true
interactive: true
working_dir: /build
command: dnf install -y make gcc openssl-devel libxml2-devel lz4-devel 
libzstd-devel bzip2-devel
become: true
 
 
What happens is that the container is being spun up, running for about 90 
seconds and then shutting down without (as far as I can tell) having installed 
i.e. make. I was thinking the detach, tty & interactive options should have 
made the container to last.
 
any hint, what I am doing wrong 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/1477412522.310885.1657547966937%40office.mailbox.org.


Re: [ansible-project] Unable to create the partition

2022-07-11 Thread Ashok Reddy
Thanks for providing your input.

On Mon, Jul 11, 2022 at 12:37 PM David Logan  wrote:

> On the systems that I build, the /boot partition is simply an ext4 or xfs
> file system. I would not be trying to use logical volume manager to try to
> build /boot.
>
> I would also look at using a kick-start method or similar to automate the
> build and get the file systems built there rather than with ansible.
>
> Anyway that is what I do, others may have a different method that may work
> better in your case.
>
> When in trouble, or in doubt
> Run in circles, scream and shout
> On 11 July 2022, at 3:58 pm, Ashok Reddy  wrote:
>>
>> Can you please suggest me how to fix this issue?
>>
>> On Monday, July 11, 2022 at 11:45:25 AM UTC+5:30 skra...@gmail.com wrote:
>>
>>> You appear to be trying to do something to the /boot partition.
>>>
>>> Perhaps you are referring to the wrong device?
>>>
>>>
>>>
>>> When in trouble, or in doubt
>>> Run in circles, scream and shout
>>> On 11 July 2022, at 3:40 pm, Ashok Reddy >> > wrote:

 lsblk

 NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

 vda252:00   50G  0 disk

 ├─vda1 252:10  500M  0 part /boot

 ├─vda2 252:204G  0 part [SWAP]

 └─vda3 252:30 10.5G  0 part /

 ---

 - hosts: default

   become: true

   become_method: sudo

   tasks:

 - name: part1

   parted:

 device: "/dev/vda1"

 number: 1

 state: present

 - name: filesystem

   filesystem:

 fstype: ext4

 dev: /dev/vda1

 - name: mounted

   mount:

 path: /opt

 src: /dev/vda1

 fstype: ext4

 state: mounted


 - name: partition

   lvg:

 vg: "datavg"

 pvs: "/dev/vda1"

 state: present

 - name: resize pv

   command: "pvresize /dev/vda1"


 - name: activate vg

   command: "vgchange -a y datavg"


 - name: Ensure

   lvol:

 vg: datavg

 lv: datalv

 size: "100%FREE"

   ignore_errors: true


 - name: sql file

   filesystem:

 dev: "/dev/datavg


 error:

 TASK [part1]
 **

 fatal: [localhost]: FAILED! => {"changed": false, "err": "Error:
 Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while running
 parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB mklabel
 msdos mkpart primary 0% 100%", "out": "", "rc": 1}



 On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:

> Thanks for providing your input.
>
> On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 dnmv...@gmail.com
>  wrote:
>
>>
>>
>> On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote:
>> > I am trying to create new partition.
>> > If that is not available, so that only need to create the /dev/vdb
>> > partition.
>>
>> Your logic is flawed.
>> You cannot create devices.
>> You can only create partitions on existing devices.
>>
>>
>>
>> --
> 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/54e13f42-7926-44d1-a6f3-a2f0ae4830d9%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/CAKRLcHh0D%3DQAgUiSFUczDWNipxigE%3DmuUamk-48b_i7i6gzY1Q%40mail.gmail.com.


Re: [ansible-project] RHCE exam question

2022-07-11 Thread Antony Stone
On Monday 11 July 2022 at 10:59:09, Mahdi Idriss wrote:

> Hi guys,
> 
> I had this question on my last ex294 ansible exame, so I was not able to
> solve it, anyone have the right playbook or can create one?

How close did you get?

I suggest the best way to get assistance on somethng like this from the 
volunteers on this list is to show us the best thing you managed to come up 
with on your own, and tell us which part of the requirements you weren't able 
to fulfil.

Someone here may then be able to help you with the specific part you had 
trouble with.

Asking for someone to come up with an entire solution to what is a pretty 
complex question is just not appropriate for this type of support list (in my 
opinion).


Antony.

-- 
I still maintain the point that designing a monolithic kernel in 1991 is a 
fundamental error.  Be thankful you are not my student.  You would not get a 
high grade for such a design :-)
 - Andrew Tanenbaum to Linus Torvalds

   Please reply to the list;
 please *don't* CC me.


[ansible-project] RHCE exam question

2022-07-11 Thread Mahdi Idriss
Hi guys,

I had this question on my last ex294 ansible exame, so I was not able to
solve it, anyone have the right playbook or can create one?

Create a playbook called roles. yml with requirements:

· The playbook contains a play that runs on hosts in the balancers
host group and uses the *balancer role*:

1.   This role configures a service to load balance web server requests
between hosts in the webservers host group

2.   Browsing to hosts in the balancers host group (example:
http://node5...com) produces the output: *Welcome message on
192.168.1.10*

3.   Reloading the browser produces output from the alternate web
server: *Welcome message on 192.168.1.11*

·

· The playbook contains a play that runs on hosts in the webservers
host group and uses the *phpinfo role*:

1.   Browsing to hosts in the webservers host group with the URL
 /hello .php produces the following output: *Hello  PHP World  from
{{ansible_fqdn}}*



2.For ex:  browsing to http://*node3*com/hello.php, produces
the following output: Hello PHP World from *node3*…...com (Note: along with
various details of the PHP configuration including the version of PHP that
is installed)





3.   Similarly browsing to http://*node4*com/hello.php. produces
the following output: Hello PHP World from *node4*…...com (Note: along with
various details of the PHP configuration including the version of PHP that
is installed.)

-- 
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/CADHi4Y8%3DP7BuZLLStqELaac3jn7_Jh%2BZYT68xFEmmjTcwFvZJA%40mail.gmail.com.


Re: [ansible-project] Install Packages after VM is created in VSphere

2022-07-11 Thread Abhijeet Janwalkar
Hi Harsha,
I have used an input yaml file to give all the required variable values for
the role to work.
used this module  community.vmware.vmware_vm_shell: extensively to avoid
opening fw ports.
As I am not connecting the VM over nw i dont need to add it in the
inventory.
All required installers are part of the Template but even if they are not
you can use this module  community.vmware.vsphere_copy to copy files
without nw.

I am doing this in vCenter so that was the difference against your use case
for Azure.

On Mon, 11 Jul 2022 at 06:01, harshc...@gmail.com 
wrote:

> Hello Abhijeet,
>
> Thanks a lot for your information. Is there any way i can have a look on
> the roles you built or how you did it? It will be really helpful.
> As i am clueless on how to achieve this. I am okay till VM creation, but
> how to connect to the VM on the next task and do activities i am bit
> confused on that.
>
> Thanks,
>
> Regards
> Harsh
>
> On Sunday, July 10, 2022 at 7:09:28 PM UTC+5:30 abhijeet@gmail.com
> wrote:
>
>> Hi Harsh,
>>
>> I just finished something like this.
>> a Role with multiple tasks to install more  6 agents, make registry
>> changes, add HDDs and format them, add more than one NIC and assign correct
>> IP and a lot more..
>>
>> I have another role to Patch the Template working on scheduling that
>> Role/Playbook.
>>
>> Warm Regards,
>> Abhi
>>
>> On Fri, 8 Jul 2022 at 13:31, harshc...@gmail.com 
>> wrote:
>>
>>>
>>> Hello All,
>>>
>>> I am Creating VM in vCenter using *community.vmware.vmware_guest, *after
>>> the VM is Created I have certain prerequisites to be fulfilled:
>>>
>>>- Do Patching
>>>- Do some package installation.
>>>- And some more
>>>
>>> How to accomplish this. I am able to create the VM then in the next task
>>> how to connect to VM and perform the above mentioned tasks.
>>>
>>> Just In case in Terraform there is remote-exec and local-exec modules,
>>> after creation of VM in azure i can directly connect to VM using these and
>>> do whatever i need.
>>>
>>> Can someone please provide the roadmap.
>>>
>>> Thanks in advance,
>>>
>>> *Regards*
>>> *Harsh*
>>>
>>> --
>>> 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/72e29365-729e-4472-9f79-5a798ada0837n%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/0ec3b687-98cd-4c56-8c00-faa8e6ee4284n%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/CACRdtvuKvFaBTJX_vcLV698TB0M7_drcfwyRfqnYr07bQN85OQ%40mail.gmail.com.


Re: [ansible-project] Use of ansible module input parameters in subsequent tasks

2022-07-11 Thread Abhijeet Kasurde
You can create a temporary variable to store both region and register value
and then access that in subsequent tasks.

For example,
...
  vars:
vpcs:
a: 1
...
  tasks:
- name: Update register variable
  set_fact:
new_vpcs: "{{ vpcs | combine({'region': 'us-east-1' }) }}"

...


On Mon, Jul 11, 2022 at 1:52 PM Akshay Jadhav  wrote:

> Hi,
>
> I want to use region attribute from below task for subsequent task but
> that attribute is not a part of output , so how I can use it next tasks.
> - name: get aws vpc details
>   ec2_vpc_net_info:
>   aws_access_key: ##
>   aws_secret_key: #
>   region: us-east-1
>   register: aws_output
>
> Region is input to the given module so I want to print that region. Please
> guide me how to print region its not a part of register. Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/33d5febb-bfcf-4a4f-8046-e38b45ca04c6n%40googlegroups.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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/CAFwWkHqi5%2BAFGgn-69206Bg5LUvQ6aB1-uK2fo4QAcAhFN18QQ%40mail.gmail.com.


[ansible-project] Use of ansible module input parameters in subsequent tasks

2022-07-11 Thread Akshay Jadhav


Hi,

I want to use region attribute from below task for subsequent task but that 
attribute is not a part of output , so how I can use it next tasks.
- name: get aws vpc details 
  ec2_vpc_net_info: 
  aws_access_key: ## 
  aws_secret_key: # 
  region: us-east-1 
  register: aws_output 

Region is input to the given module so I want to print that region. Please 
guide me how to print region its not a part of register. Thank you.

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


Re: [ansible-project] Unable to install a package

2022-07-11 Thread David Logan
Would only use sudo as the permissions are set to not allow non-root users to 
install software. We like to know what they are putting on there. 

I'll certainly look at utilising a more recent version  ut need to take some 
time as I'm currently using ansible on the Satellite server

Thanks

⁣When in trouble, or in doubt
Run in circles, scream and shout​

On 11 July 2022, 5:45 pm, at 5:45 pm, Nico Kadel-Garcia  
wrote:
>On Mon, Jul 11, 2022 at 3:10 AM David Logan  wrote:
>>
>> Unfortunately RH are still insisting on using 2.9 as their only
>solution without paying for Ansible Automation platform.
>
>Update to RHEL 8, for which ansible-core 2.12 is available as an RPM.
>
>ansible-core 2.11 can be fairly easily built for RHEL 7 as an RPM if
>you need, my published building tools ar at
>https://github.com/nkadel/ansiblerepo
>
>> I will look at updating but I've done the yum list, yum info and yum
>install from the command line on the server I'm running the playbook
>on.
>
>What does "yum list pbs-info" say? Especially if you run it as a
>non-root 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/CAOCN9rwvsaMKn8nWnSHHm9j%2Bgj5XE0oRKpwdUjFHgKp2G0vatQ%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/5a7558aa-7849-46ef-aabf-0231f2c2014f%40gmail.com.


Re: [ansible-project] Unable to install a package

2022-07-11 Thread Nico Kadel-Garcia
On Mon, Jul 11, 2022 at 3:10 AM David Logan  wrote:
>
> Unfortunately RH are still insisting on using 2.9 as their only solution 
> without paying for Ansible Automation platform.

Update to RHEL 8, for which ansible-core 2.12 is available as an RPM.

ansible-core 2.11 can be fairly easily built for RHEL 7 as an RPM if
you need, my published building tools ar at
https://github.com/nkadel/ansiblerepo

> I will look at updating but I've done the yum list, yum info and yum install 
> from the command line on the server I'm running the playbook on.

What does "yum list pbs-info" say? Especially if you run it as a non-root 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/CAOCN9rwvsaMKn8nWnSHHm9j%2Bgj5XE0oRKpwdUjFHgKp2G0vatQ%40mail.gmail.com.


Re: [ansible-project] Unable to install a package

2022-07-11 Thread David Logan
Unfortunately RH are still insisting on using 2.9 as their only solution 
without paying for Ansible Automation platform. 

I will look at updating but I've done the yum list, yum info and yum install 
from the command line on the server I'm running the playbook on. 

I'm happy to attach logs but which ones? 

⁣When in trouble, or in doubt
Run in circles, scream and shout​

On 11 July 2022, 4:03 pm, at 4:03 pm, Nico Kadel-Garcia  
wrote:
>On Sun, Jul 10, 2022 at 9:10 PM David Logan  wrote:
>>
>> Hi Folks,
>>
>> Having a problem with a rc 126 from yum. I have tried the following
>options and am receiving the following error messages. I did find a
>reference to this particular error but not on RHEL 2.9.27 (which is
>what I'm running)
>
>"ansible-2.9" is obsolete and should be updated to ansible-core 2.11
>at lease. EPEL is probably not going to publish ansible-core for RHEL
>7, since RHEL 8 is publishing ansible-core and it's well, it's
>awkward to repackage for RHEL 7. I've done it, over at
>https://github.com/nkadel/ansiblerepo/, but only publish RPM building
>tools, not RPMs.
>
>Ignore the "ansible" package from now on, install nad use
>ansible-core. What is now called "ansible" isn't, it's a bundle of
>more than 100 distinct ansible galaxy collection modules and of very
>little practical use to most ansible server setups. The modules can be
>installed individually if needed, which is much smaller and likely
>more stable.
>
>> This was working until I removed a variable from the ansible module
>but has not worked since (I'm unsure if this was the issue, it may be a
>red herring). I am running with a RedHat Satellite as my content
>server. As I note below, I can do this manually on the server in
>question. Ansible seems to have lost parts of its environment at some
>point, it can't see the paths anymore.
>>
>> I am able to do a yum/dnf info pbis-open on the server that the
>playbook is being run on. I can also do a simple
>>
>> # yum install pbis-open
>
>Since you've not included the full logs, it's difficult to guess. But
>the first step is to get to a more contemporary ansible-core for your
>ansible server, I think.
>
>
>> and this works fine. Any thoughts would be most appreciated
>>
>> Thanks
>> David
>>
>> ansible.builtin.yum
>>
>> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis]
>*
>> task path:
>/etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
>> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=false
>>   msg: No package matching 'pbis-open' found available, installed or
>updated
>>   rc: 126
>>   results:
>>   - No package matching 'pbis-open' found available, installed or
>updated
>
>I am guessing that whatever other settings you may have are disabling
>yum auditing commands for the channel that holds "pbs-open" unless run
>as the root user.
>
>Do a "yum list pbs-open" to get a better handle on the issue. Because
>that package is not in the standard CENTOS or publich RHEL channels,
>as best I can tell.
>
>> ansible.builtin.package
>>
>> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis]
>*
>> task path:
>/etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
>> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=false
>>   msg: No package matching 'pbis-open' found available, installed or
>updated
>>   rc: 126
>>   results:
>>   - No package matching 'pbis-open' found available, installed or
>updated
>>
>> ansible.built.shell and yum as command
>>
>> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis]
>*
>> task path:
>/etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
>> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=true
>>   cmd: yum install "pbis-open"
>>   delta: '0:00:00.526719'
>>   end: '2022-07-11 10:24:44.942498'
>>   msg: non-zero return code
>>   rc: 1
>>   start: '2022-07-11 10:24:44.415779'
>>   stderr: 'Error: Nothing to do'
>>   stderr_lines: 
>>   stdout: |-
>> Loaded plugins: langpacks, product-id, search-disabled-repos,
>subscription-
>>   : manager
>>
>> This system is not registered with an entitlement server. You can
>use subscription-manager to register.
>>
>> No package pbis-open available.
>>   stdout_lines: 
>>
>> After a rerun
>>
>> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis]
>*
>> task path:
>/etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
>> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=true
>>   cmd: yum install "pbis-open"
>>   delta: '0:00:00.526719'
>>   end: '2022-07-11 10:24:44.942498'
>>   msg: non-zero 

Re: [ansible-project] Unable to create the partition

2022-07-11 Thread David Logan
On the systems that I build, the /boot partition is simply an ext4 or xfs file 
system. I would not be trying to use logical volume manager to try to build 
/boot. 

I would also look at using a kick-start method or similar to automate the build 
and get the file systems built there rather than with ansible.

Anyway that is what I do, others may have a different method that may work 
better in your case. 

⁣When in trouble, or in doubt
Run in circles, scream and shout​

On 11 July 2022, 3:58 pm, at 3:58 pm, Ashok Reddy  wrote:
>Can you please suggest me how to fix this issue?
>
>On Monday, July 11, 2022 at 11:45:25 AM UTC+5:30 skra...@gmail.com
>wrote:
>
>> You appear to be trying to do something to the /boot partition. 
>>
>> Perhaps you are referring to the wrong device? 
>>
>>
>>
>> When in trouble, or in doubt
>> Run in circles, scream and shout
>> On 11 July 2022, at 3:40 pm, Ashok Reddy  wrote:
>>>
>>> lsblk
>>>
>>> NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>>>
>>> vda252:00   50G  0 disk
>>>
>>> ├─vda1 252:10  500M  0 part /boot
>>>
>>> ├─vda2 252:204G  0 part [SWAP]
>>>
>>> └─vda3 252:30 10.5G  0 part /
>>>
>>> ---
>>>
>>> - hosts: default
>>>
>>>   become: true
>>>
>>>   become_method: sudo
>>>
>>>   tasks:
>>>
>>> - name: part1
>>>
>>>   parted:
>>>
>>> device: "/dev/vda1"
>>>
>>> number: 1
>>>
>>> state: present
>>>
>>> - name: filesystem
>>>
>>>   filesystem:
>>>
>>> fstype: ext4
>>>
>>> dev: /dev/vda1
>>>
>>> - name: mounted
>>>
>>>   mount:
>>>
>>> path: /opt
>>>
>>> src: /dev/vda1
>>>
>>> fstype: ext4
>>>
>>> state: mounted
>>>
>>>
>>> - name: partition
>>>
>>>   lvg:
>>>
>>> vg: "datavg"
>>>
>>> pvs: "/dev/vda1"
>>>
>>> state: present
>>>
>>> - name: resize pv
>>>
>>>   command: "pvresize /dev/vda1"
>>>
>>>
>>> - name: activate vg
>>>
>>>   command: "vgchange -a y datavg"
>>>
>>>
>>> - name: Ensure
>>>
>>>   lvol:
>>>
>>> vg: datavg
>>>
>>> lv: datalv
>>>
>>> size: "100%FREE"
>>>
>>>   ignore_errors: true
>>>
>>>
>>> - name: sql file
>>>
>>>   filesystem:
>>>
>>> dev: "/dev/datavg
>>>
>>>
>>> error:
>>>
>>> TASK [part1] 
>>>
>**
>>>
>>> fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: 
>>> Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while
>running 
>>> parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB
>mklabel 
>>> msdos mkpart primary 0% 100%", "out": "", "rc": 1}
>>>
>>>
>>>
>>> On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:
>>>
 Thanks for providing your input.

 On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 dnmv...@gmail.com 
  wrote:

>
>
> On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote: 
> > I am trying to create new partition. 
> > If that is not available, so that only need to create the
>/dev/vdb 
> > partition. 
>
> Your logic is flawed. 
> You cannot create devices. 
> You can only create partitions on existing devices. 
>
>
>
>
>
>-- 
>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/376bc342-0b42-46c1-a664-d3977bf235a5n%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/54e13f42-7926-44d1-a6f3-a2f0ae4830d9%40gmail.com.


Re: [ansible-project] Unable to install a package

2022-07-11 Thread Nico Kadel-Garcia
On Sun, Jul 10, 2022 at 9:10 PM David Logan  wrote:
>
> Hi Folks,
>
> Having a problem with a rc 126 from yum. I have tried the following options 
> and am receiving the following error messages. I did find a reference to this 
> particular error but not on RHEL 2.9.27 (which is what I'm running)

"ansible-2.9" is obsolete and should be updated to ansible-core 2.11
at lease. EPEL is probably not going to publish ansible-core for RHEL
7, since RHEL 8 is publishing ansible-core and it's well, it's
awkward to repackage for RHEL 7. I've done it, over at
https://github.com/nkadel/ansiblerepo/, but only publish RPM building
tools, not RPMs.

Ignore the "ansible" package from now on, install nad use
ansible-core. What is now called "ansible" isn't, it's a bundle of
more than 100 distinct ansible galaxy collection modules and of very
little practical use to most ansible server setups. The modules can be
installed individually if needed, which is much smaller and likely
more stable.

> This was working until I removed a variable from the ansible module but has 
> not worked since (I'm unsure if this was the issue, it may be a red herring). 
> I am running with a RedHat Satellite as my content server. As I note below, I 
> can do this manually on the server in question. Ansible seems to have lost 
> parts of its environment at some point, it can't see the paths anymore.
>
> I am able to do a yum/dnf info pbis-open on the server that the playbook is 
> being run on. I can also do a simple
>
> # yum install pbis-open

Since you've not included the full logs, it's difficult to guess. But
the first step is to get to a more contemporary ansible-core for your
ansible server, I think.


> and this works fine. Any thoughts would be most appreciated
>
> Thanks
> David
>
> ansible.builtin.yum
>
> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis] 
> *
> task path: /etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=false
>   msg: No package matching 'pbis-open' found available, installed or updated
>   rc: 126
>   results:
>   - No package matching 'pbis-open' found available, installed or updated

I am guessing that whatever other settings you may have are disabling
yum auditing commands for the channel that holds "pbs-open" unless run
as the root user.

Do a "yum list pbs-open" to get a better handle on the issue. Because
that package is not in the standard CENTOS or publich RHEL channels,
as best I can tell.

> ansible.builtin.package
>
> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis] 
> *
> task path: /etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=false
>   msg: No package matching 'pbis-open' found available, installed or updated
>   rc: 126
>   results:
>   - No package matching 'pbis-open' found available, installed or updated
>
> ansible.built.shell and yum as command
>
> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis] 
> *
> task path: /etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=true
>   cmd: yum install "pbis-open"
>   delta: '0:00:00.526719'
>   end: '2022-07-11 10:24:44.942498'
>   msg: non-zero return code
>   rc: 1
>   start: '2022-07-11 10:24:44.415779'
>   stderr: 'Error: Nothing to do'
>   stderr_lines: 
>   stdout: |-
> Loaded plugins: langpacks, product-id, search-disabled-repos, 
> subscription-
>   : manager
>
> This system is not registered with an entitlement server. You can use 
> subscription-manager to register.
>
> No package pbis-open available.
>   stdout_lines: 
>
> After a rerun
>
> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis] 
> *
> task path: /etc/ansible/roles/glx-pbis-master/tasks/redhat_install.yml:12
> fatal: [dcslanstsap01t.cprod.corp.ntgov]: FAILED! => changed=true
>   cmd: yum install "pbis-open"
>   delta: '0:00:00.526719'
>   end: '2022-07-11 10:24:44.942498'
>   msg: non-zero return code
>   rc: 1
>   start: '2022-07-11 10:24:44.415779'
>   stderr: 'Error: Nothing to do'
>   stderr_lines: 
>   stdout: |-
> Loaded plugins: langpacks, product-id, search-disabled-repos, 
> subscription-
>   : manager
>
> This system is not registered with an entitlement server. You can use 
> subscription-manager to register.
>
> No package pbis-open available.
>   stdout_lines: 
>
> Tried DNF as this is a RHEL 8.6 box
>
> TASK [/etc/ansible/roles/glx-pbis-master : Install pbis] 
> 

Re: [ansible-project] Unable to create the partition

2022-07-11 Thread Ashok Reddy
Can you please suggest me how to fix this issue?

On Monday, July 11, 2022 at 11:45:25 AM UTC+5:30 skra...@gmail.com wrote:

> You appear to be trying to do something to the /boot partition. 
>
> Perhaps you are referring to the wrong device? 
>
>
>
> When in trouble, or in doubt
> Run in circles, scream and shout
> On 11 July 2022, at 3:40 pm, Ashok Reddy  wrote:
>>
>> lsblk
>>
>> NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>>
>> vda252:00   50G  0 disk
>>
>> ├─vda1 252:10  500M  0 part /boot
>>
>> ├─vda2 252:204G  0 part [SWAP]
>>
>> └─vda3 252:30 10.5G  0 part /
>>
>> ---
>>
>> - hosts: default
>>
>>   become: true
>>
>>   become_method: sudo
>>
>>   tasks:
>>
>> - name: part1
>>
>>   parted:
>>
>> device: "/dev/vda1"
>>
>> number: 1
>>
>> state: present
>>
>> - name: filesystem
>>
>>   filesystem:
>>
>> fstype: ext4
>>
>> dev: /dev/vda1
>>
>> - name: mounted
>>
>>   mount:
>>
>> path: /opt
>>
>> src: /dev/vda1
>>
>> fstype: ext4
>>
>> state: mounted
>>
>>
>> - name: partition
>>
>>   lvg:
>>
>> vg: "datavg"
>>
>> pvs: "/dev/vda1"
>>
>> state: present
>>
>> - name: resize pv
>>
>>   command: "pvresize /dev/vda1"
>>
>>
>> - name: activate vg
>>
>>   command: "vgchange -a y datavg"
>>
>>
>> - name: Ensure
>>
>>   lvol:
>>
>> vg: datavg
>>
>> lv: datalv
>>
>> size: "100%FREE"
>>
>>   ignore_errors: true
>>
>>
>> - name: sql file
>>
>>   filesystem:
>>
>> dev: "/dev/datavg
>>
>>
>> error:
>>
>> TASK [part1] 
>> **
>>
>> fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: 
>> Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while running 
>> parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB mklabel 
>> msdos mkpart primary 0% 100%", "out": "", "rc": 1}
>>
>>
>>
>> On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:
>>
>>> Thanks for providing your input.
>>>
>>> On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 dnmv...@gmail.com 
>>>  wrote:
>>>


 On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote: 
 > I am trying to create new partition. 
 > If that is not available, so that only need to create the /dev/vdb 
 > partition. 

 Your logic is flawed. 
 You cannot create devices. 
 You can only create partitions on existing devices. 





-- 
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/376bc342-0b42-46c1-a664-d3977bf235a5n%40googlegroups.com.


Re: [ansible-project] Unable to create the partition

2022-07-11 Thread David Logan
You appear to be trying to do something to the /boot partition. 

Perhaps you are referring to the wrong device? 



⁣When in trouble, or in doubt
Run in circles, scream and shout​

On 11 July 2022, 3:40 pm, at 3:40 pm, Ashok Reddy  wrote:
>
>
>lsblk
>
>NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
>
>vda252:00   50G  0 disk
>
>├─vda1 252:10  500M  0 part /boot
>
>├─vda2 252:204G  0 part [SWAP]
>
>└─vda3 252:30 10.5G  0 part /
>
>---
>
>- hosts: default
>
>  become: true
>
>  become_method: sudo
>
>  tasks:
>
>- name: part1
>
>  parted:
>
>device: "/dev/vda1"
>
>number: 1
>
>state: present
>
>- name: filesystem
>
>  filesystem:
>
>fstype: ext4
>
>dev: /dev/vda1
>
>- name: mounted
>
>  mount:
>
>path: /opt
>
>src: /dev/vda1
>
>fstype: ext4
>
>state: mounted
>
>
>- name: partition
>
>  lvg:
>
>vg: "datavg"
>
>pvs: "/dev/vda1"
>
>state: present
>
>- name: resize pv
>
>  command: "pvresize /dev/vda1"
>
>
>- name: activate vg
>
>  command: "vgchange -a y datavg"
>
>
>- name: Ensure
>
>  lvol:
>
>vg: datavg
>
>lv: datalv
>
>size: "100%FREE"
>
>  ignore_errors: true
>
>
>- name: sql file
>
>  filesystem:
>
>dev: "/dev/datavg
>
>
>error:
>
>TASK [part1] 
>**
>
>fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: 
>Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while
>running 
>parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB
>mklabel 
>msdos mkpart primary 0% 100%", "out": "", "rc": 1}
>
>
>
>On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:
>
>> Thanks for providing your input.
>>
>> On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 dnmv...@gmail.com
>wrote:
>>
>>>
>>>
>>> On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote:
>>> > I am trying to create new partition.
>>> > If that is not available, so that only need to create the /dev/vdb
>
>>> > partition.
>>>
>>> Your logic is flawed.
>>> You cannot create devices.
>>> You can only create partitions on existing devices.
>>>
>>>
>>>
>>>
>
>-- 
>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/0601f782-eb0c-4771-9a80-3250d1100f2bn%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/ab0f5461-d30d-4a1c-97e2-3062154e4519%40gmail.com.


Re: [ansible-project] Unable to create the partition

2022-07-11 Thread Ashok Reddy


lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

vda252:00   50G  0 disk

├─vda1 252:10  500M  0 part /boot

├─vda2 252:204G  0 part [SWAP]

└─vda3 252:30 10.5G  0 part /

---

- hosts: default

  become: true

  become_method: sudo

  tasks:

- name: part1

  parted:

device: "/dev/vda1"

number: 1

state: present

- name: filesystem

  filesystem:

fstype: ext4

dev: /dev/vda1

- name: mounted

  mount:

path: /opt

src: /dev/vda1

fstype: ext4

state: mounted


- name: partition

  lvg:

vg: "datavg"

pvs: "/dev/vda1"

state: present

- name: resize pv

  command: "pvresize /dev/vda1"


- name: activate vg

  command: "vgchange -a y datavg"


- name: Ensure

  lvol:

vg: datavg

lv: datalv

size: "100%FREE"

  ignore_errors: true


- name: sql file

  filesystem:

dev: "/dev/datavg


error:

TASK [part1] 
**

fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: 
Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while running 
parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB mklabel 
msdos mkpart primary 0% 100%", "out": "", "rc": 1}



On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:

> Thanks for providing your input.
>
> On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 dnmv...@gmail.com wrote:
>
>>
>>
>> On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote:
>> > I am trying to create new partition.
>> > If that is not available, so that only need to create the /dev/vdb 
>> > partition.
>>
>> Your logic is flawed.
>> You cannot create devices.
>> You can only create partitions on existing devices.
>>
>>
>>
>>

-- 
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/0601f782-eb0c-4771-9a80-3250d1100f2bn%40googlegroups.com.