I’m trying to use “k8s” module in ansible to create a pod/container with custom file.
For example. “/etc/httpd/conf.d/httpd.conf” should have line “VirtualHost 184.108.40.206” at the end.
Instead of copy/pasting file, is there a way to append >> at the end?
I tried below but not working:
- name: k8s citrix pod k8s: state: present definition: apiVersion: v1 kind: Pod metadata: name: cloud-init-httpd3 namespace: kuber labels: app: nginxApp service: nginxService spec: containers: - name: nginxcontainer-ntp image: nginx command: bash -c 'echo "hello" >> /etc/test' dnsConfig: nameservers: - 172.19.54.2 - 220.127.116.11 search: - mydev.com write_files: - path: /etc/httpd/conf.d/httpd.conf permissions: 0644 owner: root content: | VirtualHost mydev.com # Allow only time queries, at a limited rate, sending KoD when in excess. # # Allow all local queries (IPv4, IPv6) restrict default nomodify nopeer noquery limited kod restrict 127.0.0.1 restrict [::1] kubeconfig: ~/.kube/config delegate_to: localhost register: kubefacts - debug: var: kubefacts