# Ansilbe: Gentoo node not emerging package

## psychobyte

Hi,

Anyone familiar w/ Ansible?   I'm trying to have a remote Gentoo node emerge a package but, the control machine states that "ok: [rnce-lcl] => {"changed": false, "msg": "Packages already present."}".  Control machine is ansible 1.8.2 on CentOS7

---

- name: Install syslog-ng

  hosts: rnce-lcl

  remote_user: root

  tasks:

    - portage: package=syslog-ng state=present verbose=yes               

After some searching I attributed this to Genoo having python-3.x installed.  So I then tried setting "ansible_python_interpreter: /usr/bin/python2" in my "all" group inventory file.  Still doesn't work. 

On the gentoo node, I used eselect python list to see what default python version it's using. It seems to be using python2.6 by default 

Available Python interpreters:

  [1]   python2.6 *

  [2]   python3.1

One thing i noticed after this was doing a "ansible rnce-lcl -m setup -i inventory/"

the "ansible_python_interpreter" variable is not shown. should it be?

It seems that the Gentoo  node is using python2 by default which should work.

Any ideas on what else I can do to get emerging to work?

FULL OUTPUT:

[root@centos7-repo ansible]# ansible-playbook -vvvvv gtoo_service.yml -i inventory/ 

PLAY [Configuring service] **************************************************** 

GATHERING FACTS *************************************************************** 

<10.0.1.162> ESTABLISH CONNECTION FOR USER: root

<10.0.1.162> REMOTE_MODULE setup

<10.0.1.162> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.1.162 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1425063630.46-145933122788716 && echo $HOME/.ansible/tmp/ansible-tmp-1425063630.46-145933122788716'

<10.0.1.162> PUT /tmp/tmpKZ8mDA TO /root/.ansible/tmp/ansible-tmp-1425063630.46-145933122788716/setup

<10.0.1.162> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.1.162 /bin/sh -c 'LANG=C LC_CTYPE=C /usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1425063630.46-145933122788716/setup; rm -rf /root/.ansible/tmp/ansible-tmp-1425063630.46-145933122788716/ >/dev/null 2>&1'

ok: [rnce-lcl]

TASK: [portage package=syslog-ng state=present verbose=yes] ******************* 

<10.0.1.162> ESTABLISH CONNECTION FOR USER: root

<10.0.1.162> REMOTE_MODULE portage package=syslog-ng state=present verbose=yes

<10.0.1.162> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.1.162 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1425063631.74-281088121785178 && echo $HOME/.ansible/tmp/ansible-tmp-1425063631.74-281088121785178'

<10.0.1.162> PUT /tmp/tmp4UKrD7 TO /root/.ansible/tmp/ansible-tmp-1425063631.74-281088121785178/portage

<10.0.1.162> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.0.1.162 /bin/sh -c 'LANG=C LC_CTYPE=C /usr/bin/python2 /root/.ansible/tmp/ansible-tmp-1425063631.74-281088121785178/portage; rm -rf /root/.ansible/tmp/ansible-tmp-1425063631.74-281088121785178/ >/dev/null 2>&1'

ok: [rnce-lcl] => {"changed": false, "msg": "Packages already present."}

PLAY RECAP ******************************************************************** 

rnce-lcl                   : ok=2    changed=0    unreachable=0    failed=0

----------

## psychobyte

OK. so in dry run mode it returns that the package is already installed instead of "it is absent but will be installed".  it seems to work fine.

----------

## timeraider

Because I just stumbled across the same error I have created a bug report for the ansible extra-modules.

Anyone interested can find it here:

https://github.com/ansible/ansible-modules-extras/issues/750

----------

