I have a file called packages.txt which contains a list of packages. I have to read each line of that package.txt through my ansible file rpm.yml. Here is my code
- hosts: myhost
tasks:
- name: RPM Filter
theforeman.foreman.content_view_filter:
username: "admin"
password: "admin"
server_url: "myhost"
name: "rpm filter"
organization: "myorg"
content_view: "My content view"
filter_type: "rpm"
package_name: "{{ item }}"
inclusion: True
loop:
- packages.txt
My packages.txt contains these
open-ssh
nginx
grafana
vim
Any help would be appreciated
You will need an additional task to read the file. The simplest way would be to
cat
the file andregister
into a variable. Then this variable can be used for the next task.Something like: