logo
down
shadow

Ansible npm install list in a single session


Ansible npm install list in a single session

By : Dustin Petersen
Date : November 20 2020, 03:01 PM
may help you . I have a long list of items for Ansible npm install, and using a "with_items" is very slow. I would like to use a list in a single session, such as: ,
Could this work with npm?
code :
cmd: /bin/npm install --global 'package1 package2'


Share : facebook icon twitter icon
Can I install (or remove) Ansible role from Galaxy using ansible-pull?

Can I install (or remove) Ansible role from Galaxy using ansible-pull?


By : user2264262
Date : March 29 2020, 07:55 AM
will help you If I understand you correctly, you're trying to download and install roles from Ansible Galaxy from the command line, in a hands-off manner, possibly repeatedly (via cron). If this is the case, here's how you can do it.
code :
# download the roles
ansible-galaxy install --ignore-errors f500.elasticsearch groover.packerio
# run ansible-playbook to install the roles downloaded from Ansible Galaxy
ansible-playbook -i localhost, -c local <(echo -e '- hosts: localhost\n  roles:\n  - { role: f500.elasticsearch, elasticsearch_cluster_name: "my elasticsearch cluster" }\n  - { role: groover.packerio, packerio_version: 0.6.1 }\n')
Ansible: install multiple Python packages on a single session

Ansible: install multiple Python packages on a single session


By : Adam Grolli
Date : March 29 2020, 07:55 AM
Hope that helps Expanding on Ben's answer, you can also continue to preserve the package list as a yaml list like you have it, and do the projection to a single value when you pass it to the pip module like:
pip: name="{{ python_packages_to_install | join(' ') }}"
Ansible - Looping through a list to specify many arguments to a single command

Ansible - Looping through a list to specify many arguments to a single command


By : Rajasekhar Reddy Ch
Date : March 29 2020, 07:55 AM
wish helps you You can use Jinja2 filters to join list into string:
code :
- command: /usr/bin/disk-monitor-script --disk-path={{ my_items | join(' --disk-path=') }}
  vars:
    my_items: [ item1, item2, item3 ]
Reduce Ansible list of objects to a single string of concatenated object values

Reduce Ansible list of objects to a single string of concatenated object values


By : user2684412
Date : March 29 2020, 07:55 AM
To fix this issue I am trying to parse the output of elasticache_facts ansible module, to extract the IPS and the ports of the memcached nodes in a string of the form "addr1: port1 addr2:port2 ..."(I want to store this string in a configmap to be used in an app). , Here are two ways to achieve what you are looking for:
code :
#!/usr/bin/env ansible-playbook
---
- name: Lets munge some data
  hosts: localhost
  become: false
  gather_facts: false
  vars:
    my_list:
    - address: '10.0.0.0'
      port: '80' 
    - address: '10.0.0.1'
      port: '88' 
  tasks:
  - name: Quicky and dirty inline jinja2
    debug: 
      msg: "{% for item in my_list %}{{ item.address }}:{{ item.port }}{% if not loop.last %} {% endif %}{% endfor %}"

  # Note the to_json | from_json workaround for https://github.com/ansible/ansible/issues/27299
  - name: Using JSON Query
    vars:
      jmes_path: "join(':', [address, port])"
    debug: 
      msg: "{{ my_list | to_json | from_json | map('json_query', jmes_path) | join(' ') }}"
PLAY [Lets munge some data] **********************************************************************************************************************************

TASK [Quicky and dirty inline jinja2] ************************************************************************************************************************
ok: [localhost] => {
    "msg": "10.0.0.0:80 10.0.0.1:88"
}

TASK [Using JSON Query] **************************************************************************************************************************************
ok: [localhost] => {
    "msg": "10.0.0.0:80 10.0.0.1:88"
}

PLAY RECAP ***************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0   
Install ansible galaxy using ansible

Install ansible galaxy using ansible


By : s_hutch
Date : October 10 2020, 10:00 PM
will help you There is no galaxy module. The list of options in How to automatically install Ansible Galaxy roles? is complete. For other options you might want to review ansible-runner, or AWX.
Your conclusion "it just runs the manual command every time, and it is not idempotent" was too quick. Such a task is idempotent with the parameter creates and appropriate ansible_roles_list.
code :
- name: Install roles from Ansible Galaxy
  command: "ansible-galaxy install {{ item.role_name }}"
  args:
    creates: "{{ item.role_path }}"
  loop: "{{ ansible_roles_list }}"
shadow
Privacy Policy - Terms - Contact Us © voile276.org