title: How to create a new partition with Ansible
body: <p>When I run this on the command line it works fine:</p>
  
  <pre><code> echo -e "n\np\n1\n\n\nw" | sudo fdisk /dev/sdb
  </code></pre>
  
  <p>But in Ansible it does not want to run in shell:</p>
  
  <pre><code> - name: partition new disk
     shell: echo -e "n\np\n1\n\n\nw" | sudo fdisk /dev/sdb
  </code></pre>
  
  <p>It does not come back with an error, but it does not create the partition either.</p>
  
  <p>I checked that Ansible and LVM will not do what I need.</p>
  
  <p>Any advice?</p>