Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    might need a new connection plugin if that doesnt exist already
    i think hes trying to hit a service registered in consul (?)

    @drewmullen oh you are probably right.

    I don't see any inventory or connection plugins for Consul. Might be able to use the lookup plugin to retreive the DNS names from Consul, but I don't use Consul all that much so not sure if that is how it works exactaly.

    Nicholas Amorim
    Yeah, there's nothing done to support this. There's a dynamic inventory plugin consul_io in ansible's contrib and seems currently broken (plus requires a bit more setup than the simple use case I have: service name becomes a group name and all the healthy hosts populate the group)
    yeah, I looked around and didnt see much. Im also trying to think about various use cases. id be open to helping write a connection plugin to support it but im not intimate with consul service discovery. all that to say, would love to hear use cases that this feature would support

    Hi guys, I'd be grateful if you could help me out with my issue:

    Having tested my playbook and verified that it runs successfully - I'm trying to run it every 30 minutes using a cron job:
    /10 * /usr/bin/ansible-playbook /home/ansible/my_playbook.yml

    I've already set the "execute" permissions of the my_playbook.yml file. tried to run it as the user ansible:
    /10 * ansible /usr/bin/ansible-playbook /home/ansible/my_playbook.yml

    I've tried disabling selinux as well, but it didnt help.

    I can see that the cronjob executes (sudo tail -f /var/log/cron) but the playbook nerve runs.

    Bhaskar Pasupuleti

    Hi Guys, I need your assistance on Ansible. I am trying to install Debain pacakges using Ansible and I use with_items. Now the list is becoming bigger, so required help on how to ask with_items to read the packages from file. My lines are below. - name: Install Base Packages for
    apt: name={{ item }}

    - vim-gtk3
    - apt-transport-https
    - ca-certificates
    - wget
    - software-properties-common
    - locales
    - build-essential
    - acl
    - ntp
    - htop
    - git
    - supervisor
    - python-pip
    - python3-pip
    - nginx
    - build-essential
    - crossbuild-essential-arm64
    - crossbuild-essential-armel
    - crossbuild-essential-armhf
    - crossbuild-essential-powerpc
    - crossbuild-essential-ppc64el
    - crossbuild-essential-mipsel
    - devscripts
    - dh-buildinfo
    - build-essential
    - git
    - cmake
    - g++
    - ccache
    - curl
    - dh-autoreconf
    - lttng-tools
    - liblttng-ust-dev
    - libssh2-1-dev
    - zlib1g-dev
    - liblttng-ust-dev
    - libssh2-1-dev
    - google-mock
    - mysql-server
    - golang-goprotobuf-dev
    - golang-1.8-go
    - fakechroot
    - curl
    - python3-pexpect
    - libboost-all-dev
    - libc-ares-dev
    - libncurses5-dev
    - libncursesw5-dev
    - libreadline-dev
    - libssl-dev:amd64
    - bison
    - libprotobuf-dev
    - libprotoc-dev
    - python-configparser
    - python-pip
    - gdb
    - u-boot-tools
    - screen
    - ruby
    - ruby-dev:amd64
    - ruby-did-you-mean
    - ruby-minitest
    - ruby-net-telnet
    - ruby-power-assert
    - ruby-test-unit
    - ruby2.3
    - ruby2.3-dev:amd64
    - astyle
    - cpp-6-aarch64-linux-gnu
    - cpp-6-arm-linux-gnueabi
    - cpp-6-arm-linux-gnueabihf
    - cpp-aarch64-linux-gnu
    - cpp-arm-linux-gnueabi
    - cpp-arm-linux-gnueabihf
    - g++-6-aarch64-linux-gnu
    - g++-6-arm-linux-gnueabi
    - g++-6-arm-linux-gnueabihf
    - g++-aarch64-linux-gnu
    - g++-arm-linux-gnueabi
    - g++-arm-linux-gnueabihf
    - i2c-tools
    - linux-libc-dev:amd64
    - linux-libc-dev-arm64-cross
    - linux-libc-dev-armel-cross
    - linux-libc-dev-armhf-cross
    - gcc-6-aarch64-linux-gnu
    - gcc-6-arm-linux-gnueabi
    - gcc-6-arm-linux-gnueabihf
    - gcc-aarch64-linux-gnu
    - gcc-arm-linux-gnueabi
    - gcc-arm-linux-gnueabihf
    - libcups2
    - samba
    - samba-common
    - cups
    - tightvncserver
    - winbind
    - libpam-winbind
    - libnss-winbind
    - krb5-config
    - resolvconf
    - realmd
    - sssd
    - sssd-tools
    - adcli
    - krb5-user
    - packagekit
    - samba-common
    - samba-common-bin
    - samba-libs
    - ntp


    - packages
    Nicholas Amorim

    @drewmullen My specific example (although I've heard other people doing the same albeit through much more convoluted ways) is making sure that a given playbook runs against a host that is available for sure.

    An example: automated deploys. Our registry informs our orchestrator (stackstorm) that a new image is available to be deployed. We use Docker Swarm, so Ansible needs to run a playbook against any Swarm manager host but only once (run_once: true). We have 5 managers and there's no guarantee that all 5 will be available, so it'd be useful to have a dynamic host list created from Consul only with healthy hosts.

    Sure there's other ways to accomplish that even using Ansible alone, but as we are moving to using Consul as our DNS/HealthChecker that would be incredibly useful.

    I'm still figuring out how consul_io on Ansible's contrib is supposed to work to see if it suits my use case: create a group of hosts for each service and add inside only hosts that are healthy


    oh man. @nicholasamorim i didnt even see that consul_io thing! the docs are pretty bad though. if you end up using it you should improve those docs lol

    just taking a quick look seems like you need to:

    1. create a consul_io.ini file in the directory youre executing from that contains at least the url (with port). you probably want to pair this down using the options
    2. ansible -i consul_io.py all -m ping
    @bhaskarproy What version of ansible are you using?
    Nicholas Amorim
    @drewmullen will give it a go this week again. Tried once just to check it out but it failed with some python errors on None/List, apparently expecting some value to be in the KV storage, but I will try again soon. but yeah the docs are awful.
    Bhaskar Pasupuleti
    @ecaepp I am using ansible 2.8.2
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /usr/bin/ansible
    python version = 2.7.5 (default, Jun 20 2019, 20:27:34) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

    @bhaskarproy In the version of Ansible you are using you can pass an array of packages straight to the name parameter.

    # defualts/main.yml
      - httpd
      - curl
      - fail2ban
      - ...
    # tasks/main.yml
    - name: Install some packages
        name: "{{ my_packages }}"
        state: present

    This method is much more efficient and faster that looping over an array as it equates to $ yum install httpd curl fail2ban on the command line.

    If you still prefer to use a file you can use with_file instead of with_items to loop over the file contents.
    See https://docs.ansible.com/ansible/2.4/playbooks_loops.html#looping-over-files

    @all Hello folks,
    Can anyone help me how to automate fallowing using ansible for eg: assume I have an aws images AMI-123latest and currently I’m already running 10 ec2 instances running on old AMI-123OLD so now i have to automate the upgradation of all 10 ec2 instances to latest AMI-123latest
    suuggest best practies to automate this usecase If possible any sample scripts URL in github ??
    @sumanchowdare bro take a snapshot of the volumes and mount it to the 10Newec2 instance
    just surf for the cli command of adding volume to instance and provke that in ansible scripts
    wilornel Hi #Ansible! I was wondering if you know of a certain repository that contains a playbook for installing kubernetes
    wilornel the binaries
    wilornel Hi Ansible team! Anyone active here?
    wilornel I got this thing with Packer and Ansible that I do not understand
    wilornel I setup the ansible playbook and have packer run it. However, ansible is not running some roles because "hosts: all" does not match localhost. Does anyone know what I'm talking about?
    wilornel Like who assigns what host name is the instance?
    wilornel I don't know if packer does that
    Matthew Davis
    are you wanting to run it on localhost directly I take it?
    just set host: localhost
    Hello all
    Can anyone help me with this error? I'm just pasting last few lines of the error.
    File "/usr/local/lib/python3.6/site-packages/molecule/provisioner/ansible.py", line 713, in manage_inventory
    File "/usr/local/lib/python3.6/site-packages/molecule/provisioner/ansible.py", line 782, in _remove_vars
    File "/usr/lib64/python3.6/shutil.py", line 486, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
    File "/usr/lib64/python3.6/shutil.py", line 444, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
    File "/usr/lib64/python3.6/shutil.py", line 442, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
    PermissionError: [Errno 13] Permission denied: 'bitbucket_grp'
    wilornel sounds like you got a permission denied man
    wilornel I feel like we are missing context to help
    wilornel Matthew Davis: Thanks
    wilornel Matthew Davis (Gitter): Thanks
    wilornel I'm getting a new issue
    wilornel amazon-ebs: mkdir: cannot create directory '/root': Permission denied
    wilornel Do you have documentation on permission issues, and ansible trying to create a root dir?
    wilornel what is trying to create a root dir? The roles I'm using?
    wilornel It's weird, I see ansible trying to ssh into localhost when clearly packer is building something in aws
    wilornel I need help with apt_key.. I think that ansible is ssh'ed in as root but I'm getting an error that says that apt-key can only be ran by root.
    wilornel Looks like there's an issue on this that was closed by ansible with no further comment? ansible/ansible#31145
    wilornel Alright, I'm getting to it..
    wilornel Now, I don't know the best way to wait.
    Im using vmware plugin and would like to use the tags for groups. I notice when I run ansible-inventory that tags are included to create groups. How can I add vm tags to the groups?
    @reneeshk Going to need some more information about what you are doing and trying to accomplish.
    Terry Odom
    Hell All. I get the following error when running a playbook but not sure how to address the colon like the error implies. Any suggestions? Thanks in advance
    The offending line appears to be:
        - { path: C:\ansible\apps\software\Notepad++\npp.7.5.3.Installer.x64.exe, arguments: /S }
                   ^ here
    @TerryOdom try double quoting the path "C:\ansible\apps\software\Notepad++\npp.7.5.3.Installer.x64.exe"
    Terry Odom
    ok, will try that and see. thanks
    Terry Odom
    @ecaepp Thanks again! Just confirming your guidance worked. Much appreciated!!!