tasks:
  - command:
      cmd: "openssl rand -hex 7"
      creates: /root/.my.cnf 
    register: mynewpw
 
  - copy:
      content: "[client]\nuser=root\npassword={{ mynewpw.stdout }}\n"
      dest: /root/.my.cnf
      force: no
