我正在使用下面的剧本将条目写入/etc/fstab
& 以创建交换文件:
---
- name: Configure SWAP
hosts: localhost
become: yes
become_user: root
tasks:
- name: Configuring a SWAP
command: "{{ item }}"
loop:
- mkswap -f "{{ ebs_swap }}"
- echo "UUID=$(blkid -s UUID -o value {{ ebs_swap }}) swap swap defaults 0 0" | sudo tee -a /etc/fstab
- swapon -a
我们使用以下命令运行它:
ansible-playbook mount.yml -e "ebs_swap=/dev/xvdj"
谁能告诉我为什么我无法进入/etc/fstab
&当我试图在命令之上运行时它获得成功。