'Create a new LXC container.
This method will build and execute a shell command to build the
container. It would have been nice to simply use the lxc python library
however at the time this was written the python library, in both py2
and py3 didn\'t support some of the more advanced container create
processes. These missing processes mainly revolve around backing
LXC containers with block devices.'

def _create(self):

    build_command = [self.module.get_bin_path('lxc-create', True), ('--name    %s' % self.container_name), '--quiet']
    build_command = self._add_variables(variables_dict=self._get_vars(variables=LXC_COMMAND_MAP['create']['variables']), build_command=build_command)
    if (self.module.params.get('container_log') in BOOLEANS_TRUE):
        try:
            if (os.getuid() != 0):
                log_path = os.getenv('HOME')
            else:
                if (not os.path.isdir('/var/log/lxc/')):
                    os.makedirs('/var/log/lxc/')
                log_path = '/var/log/lxc/'
        except OSError:
            log_path = os.getenv('HOME')
        build_command.extend([('--logfile    %s' % os.path.join(log_path, ('lxc-%s.log' % self.container_name))), ('--logpriority    %s' % self.module.params.get('container_log_level').upper())])
    template_options = self.module.params.get('template_options', None)
    if template_options:
        build_command.append(('--    %s' % template_options))
    (rc, return_data, err) = self._run_command(build_command)
    if (rc != 0):
        message = 'Failed    executing    lxc-create.'
        self.failure(err=err, rc=rc, msg=message, command='    '.join(build_command))
    else:
        self.state_change = True
